[wp-hackers] WP_Query loop generates a lot of mySQL queries

Otto otto at ottodestruct.com
Tue Oct 30 14:29:42 UTC 2012


On Mon, Oct 29, 2012 at 4:08 PM, John Blackbourn
<johnbillion+wp at gmail.com> wrote:
> On 29 October 2012 20:38, Otto <otto at ottodestruct.com> wrote:
>> Turn off the meta and term caching, since you're not using them in
>> that Loop. Set 'update_post_meta_cache' and 'update_post_term_cache'
>> to false in your WP_Query's.
>
> I wonder if core could lazy-load the meta cache or term cache the
> first time a meta or term function is called within a loop?

Sure, but it probably would not add a lot of benefit, since almost
every Loop uses terms and/or meta in some way. It's only small custom
loops like this that don't use those.

-Otto


More information about the wp-hackers mailing list