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

WordPress Trac noreply at wordpress.org
Sat Oct 1 18:28:07 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):

 Replying to [comment:12 bordoni]:
 > I love the new code, because it kinda does work for the users, but I
 don't think it's best idea to introduce more fields to registering process
 for such a specific case.
 > Keep in mind that all other places in WordPress structure it's used the
 filter to allow bailing early.

 How about the new patch? It combines both use cases into a single filter.
 Devs can easily remove specific taxonomies from the list, and easily short
 circuit the `foreach` loop by returning false or an empty array. Supplying
 `$post` allows it to be post specific as well.

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

More information about the wp-trac mailing list