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

WordPress Trac noreply at wordpress.org
Wed Aug 26 06:51:04 UTC 2020


#50567: Set $post filter in update_post_cache()
----------------------------------------+--------------------------
 Reporter:  Cybr                        |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  5.6
Component:  Posts, Post Types           |     Version:  5.5
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:  performance
----------------------------------------+--------------------------

Comment (by Cybr):

 > The one question I have about the patch is is there a situation in which
 `$post->filter` can be a value other than `raw`?

 I looked at the default behavior from the `WP_Post` class constructor. I
 don't think another value (like `display`) would benefit most sites. You
 can test this, of course. Keep in mind that plugins and themes will
 (significantly) affect this behavior. We learned to escape as late as
 possible, so using `raw` values should be fine for most cases.

 > Maybe it would be better to call `empty( $post->filter ) ||
 $post->filter !== raw`.

 Yes, I believe that'd be better, too. But, please keep in mind that
 `WP_Post` does not check against that, so this change adds a discrepancy.
 We may want to improve things in the `WP_Post` class, as well.

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


More information about the wp-trac mailing list