[wp-trac] [WordPress Trac] #50567: Set $post filter in update_post_cache()

WordPress Trac noreply at wordpress.org
Fri Apr 1 03:16:48 UTC 2022

#50567: Set $post filter in update_post_cache()
 Reporter:  Cybr                      |       Owner:  peterwilsoncc
     Type:  enhancement               |      Status:  closed
 Priority:  normal                    |   Milestone:  6.0
Component:  Posts, Post Types         |     Version:
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
Changes (by peterwilsoncc):

 * status:  assigned => closed
 * resolution:   => fixed


 In [changeset:"53042" 53042]:
 #!CommitTicketReference repository="" revision="53042"
 Posts, Post Types: Set post filter in `update_post_cache()`.

 Ensure the post cache is primed with raw sanitized data. This resolves an
 inconsistency between how posts retrieved via `get_post()` vs `WP_Query`
 are cached.

 This prevents `sanitize_post( $post, 'raw' )` being run multiple times on
 a cached post. This can happen over 20 times per post on some page loads
 so avoiding this will provide a noticeable performance boost.

 Props Cybr, SergeyBiryukov, peterwilsoncc, hellofromTonya, costdev.
 Fixes #50567.

Ticket URL: <https://core.trac.wordpress.org/ticket/50567#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list