Is a foreach loop better for site performance / server resources than WP_Query ?
-
OOPS… meant to put in the title a get_posts for each loop…
Is it true that WP_Query is a problem for performance and that get_posts would be a better choice for querying posts? It makes sense that is all the posts have been queried from the loop that there is no need to perform another query.
I was able to grab the 3 most recent posts from a category both ways. Right now in local dev I have 2 consecutive sections that are identical. So which one do I keep and which one do I remove, if you had to choose?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Is a foreach loop better for site performance / server resources than WP_Query ?’ is closed to new replies.