[wp-trac] [WordPress Trac] #48408: Introduce eagerloading of meta data

WordPress Trac noreply at wordpress.org
Wed Oct 23 14:01:39 UTC 2019


#48408: Introduce eagerloading of meta data
-------------------------------+------------------------------
 Reporter:  mattiasf           |       Owner:  (none)
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Query              |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  performance
-------------------------------+------------------------------

Comment (by mattiasf):

 Replying to [comment:1 ocean90]:
 > Hello @mattiasf, welcome to WordPress Trac!
 >
 > I think what you're looking for is the `update_post_meta_cache` argument
 of `WP_Query`, see
 https://developer.wordpress.org/reference/classes/wp_query/#caching-
 parameters. When set to true it fetches all meta data in one query by
 calling `update_postmeta_cache()`.

 Thanks for prompt reply, and thanks for the welcome.

 So in fact, what you're saying is that eager loading is already introduced
 in the current versions of WordPress? So when fetching posts, say through
 WP_Query, and then calling `wp_postmeta` it makes a query to fetch all
 meta for all $posts in the WP_Query? If that's the case, then that's great
 news!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48408#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list