[wp-trac] [WordPress Trac] #22271: get_post_class() does not always apply filter to output

WordPress Trac noreply at wordpress.org
Mon Nov 5 18:12:29 UTC 2012


#22271: get_post_class() does not always apply filter to output
-------------------------+------------------------------
 Reporter:  F J Kaiser   |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Template     |     Version:  3.4
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |
-------------------------+------------------------------

Comment (by Rarst):

 Some things to note:

  - `get_post_class()` does not pass post object, only ID. Any filter will
 have to retrieve post object anyway... and as for me it's filter's problem
 if it doesn't check that if that came up with something.
  - there are other filters that will happily pass non-valid ID, for
 example `get_the_title`. So case can be made that specific
 `get_post_title` filter ''historically'' only passes valid ID, but there
 is no general case that filter passing ID as additional argument must
 ensure that it is valid one.

 PS introducing new filter doesn't make sense to me because I don't see
 strong case to not just apply existing to all cases and be done.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22271#comment:27>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list