[wp-trac] [WordPress Trac] #35816: Add "after_get_posts" action to `WP_Query::get_posts()`

WordPress Trac noreply at wordpress.org
Sat Feb 13 20:10:48 UTC 2016


#35816: Add "after_get_posts" action to `WP_Query::get_posts()`
---------------------------+--------------------------
 Reporter:  stevegrunwell  |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  4.5
Component:  Query          |     Version:  trunk
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  performance
---------------------------+--------------------------

Comment (by lpawlik):

 @boonebgorges thank you for taking care of my patch. I like how you
 implemented initial idea - this looks great and from my internal tests it
 fully solves our issues however I think that maybe we could add also some
 action hook when posts are added into lazy loader class. I've modified
 your patch a bit. I believe that even 100k of posts (actually only ID +
 post_type) inside `WP_Metadata_Lazyloader` won't occupy too much memory
 however it would be excellent if developers could control it somehow
 (`reset()` method added into `WP_Metadata_Lazyloader`)

 {{{#!php
 <?php
 add_action( 'metadata_lazyloader_posts_added', function(
 WP_Metadata_Lazyloader $metadata_loader ) {
     $metadata_loader->reset();
 });
 }}}

 I think that your patch fully solves those issues (I saw that comments
 should also be fixed as they behave the same as posts) and it would be
 awesome if it could be merged into core.

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


More information about the wp-trac mailing list