[wp-trac] [WordPress Trac] #31398: Add theme function wp_add_body_class() to abstract filtering `body_class`

WordPress Trac noreply at wordpress.org
Sat Feb 21 23:01:56 UTC 2015


#31398: Add theme function wp_add_body_class() to abstract filtering `body_class`
---------------------------------+------------------------------
 Reporter:  mattheweppelsheimer  |       Owner:
     Type:  enhancement          |      Status:  new
 Priority:  normal               |   Milestone:  Awaiting Review
Component:  Themes               |     Version:
 Severity:  normal               |  Resolution:
 Keywords:                       |     Focuses:  template
---------------------------------+------------------------------
Changes (by obenland):

 * keywords:  dev-feedback =>


Comment:

 I think the only time it would improve the developer experience would be
 if the theme would only need to add one class. As soon as it would have to
 be called more than once we're adding unnecessary callbacks to that
 filter. But adding one class can also be done by passing it as an argument
 to `body_class()` directly, without even having the need of using the
 filter.

 Adding a function to wrap a filter and callback would also add to the
 confusion of inconsistent WordPress APIs, which makes the benefit fairly
 marginal in my opinion.

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


More information about the wp-trac mailing list