Issue Description
Here is a way to reduce the number of queries when using WP_Query without affecting the results returned.
How to Fix the Issue
Its an undocumented feature, this page has a useful write up on it.
If you aren’t paginating results adding this code reduces the number of queries ran by WP_Query by 1.
Examples of where this can be used (i.e. where pagination isn’t being used)
In a website footer where you return 3 most recent posts.
Sitemap
Where more posts are ajax’d in via infinite scroll/load more button.
Fixed Code Snippets
'no_found_rows' => true,
References
Reference Description |
Reference Link |
---|---|
More detail on kinsta.com |
View Page |