[wp-trac] [WordPress Trac] #42924: Current implementation of WP_Post::get_instance makes the_posts and posts_results filters useless

WordPress Trac noreply at wordpress.org
Tue Dec 19 00:39:57 UTC 2017


#42924: Current implementation of WP_Post::get_instance makes the_posts and
posts_results filters useless
--------------------------+----------------------
 Reporter:  panbolec      |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Query         |     Version:  trunk
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by dd32):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Hi @panbolec and welcome to Trac.

 These filters are designed to be used to provide `WP_Query` results
 directly from another data-source, such as from a cache (memcache) or from
 another query engine (elastic search, sphinx, etc). The two hooks
 mentioned by themselves are not solely responsible for that, and are AFAIK
 mostly the post-query save-in-cache variants.

 They're not designed to be used for "post data modifications", although
 you could attempt it (you'd also have to use a much later hook in
 conjunction with it I believe).

 It seems that you may be asking for a filter to allow `WP_Post` objects to
 be modified after querying, if that's the case, I'll redirect that to
 #12955

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


More information about the wp-trac mailing list