[wp-trac] [WordPress Trac] #57496: Lazy load post meta

WordPress Trac noreply at wordpress.org
Tue Dec 3 22:11:31 UTC 2024


#57496: Lazy load post meta
--------------------------------------+-----------------------------
 Reporter:  spacedmonkey              |       Owner:  pbearne
     Type:  enhancement               |      Status:  accepted
 Priority:  normal                    |   Milestone:  Future Release
Component:  Posts, Post Types         |     Version:  4.5
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+-----------------------------

Comment (by peterwilsoncc):

 @spacedmonkey For term meta, `WP_Query` accepts an argument to indicate it
 should be lazy loaded. The proposed PR requires developers to manually
 call `wp_lazyload_post_meta()` after making a query that does not prime
 the post meta.

 I think it would be better to add an argument to lazy load post meta
 within `WP_Query` so developers can pass the argument and it just works.
 The new argument would need to affect how `update_post_term_cache` works,
 similar to the `lazy_load_term_meta` argument.

 I think that would reduce the chance of developers making mistakes and
 accidentally increasing the number of database queries when their intent
 is to limit the post meta query to be made only as required.

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


More information about the wp-trac mailing list