[wp-trac] [WordPress Trac] #37114: Allow short-circuiting `get_post_class` for performance

WordPress Trac noreply at wordpress.org
Thu Oct 6 17:19:18 UTC 2016


#37114: Allow short-circuiting `get_post_class` for performance
-------------------------------------------------+-------------------------
 Reporter:  bordoni                              |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Posts, Post Types                    |  Review
 Severity:  normal                               |     Version:  4.6
 Keywords:  has-patch dev-feedback needs-        |  Resolution:
  testing                                        |     Focuses:  template,
                                                 |  performance
-------------------------------------------------+-------------------------

Comment (by desrosj):

 @bordoni I'm not sure I like passing the `$classes` array in the filter.
 All classes added before this can be determined from the `WP_Post` object
 that is passed.
 * Post status: `$post->post_status`
 * Post type: `$post->post_type`
 * Post ID: `$post->ID
 * Post thumbnail: `has_post_thumbnail()`
 * Post password required/protected: `post_password_required()`
 * Sticky: `is_sticky()`
 * Post format: `get_post_format()`

 This filter would occur before the `'post_class'` filter is applied, which
 is the only way that other classes could be added.

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


More information about the wp-trac mailing list