Too Many Queries
I am currently using this code to query specific posts by month and year in
a page template, so I have to repeat this query 12 times for every year
everytime the page is loaded:
if ($wp_query->post_count >= 1)
I am worried that this is too many queries. Is there a better way of doing
this? Perhaps something along these lines:
if ($wp_query->month_num = 1) && ($wp_query->post_count >= 1)
I know month_num won’t work but is there any way of getting the month number so I can pass it in the PHP if statement? That way I only have to run one query for each year.
- The topic ‘Too Many Queries’ is closed to new replies.