[wp-trac] [WordPress Trac] #21912: Add return filter to current_theme_supports()

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 17 18:39:29 UTC 2012


#21912: Add return filter to current_theme_supports()
-----------------------------+-------------------------
 Reporter:  DJPaul           |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Themes
  Version:  trunk            |   Severity:  normal
 Keywords:  has-patch        |
-----------------------------+-------------------------
 current_theme_supports() makes it hard for plugins to affect whether a
 theme supports a certain feature.

 The use case I have is that I am building a plugin that utilises bbPress
 (and soon, BuddyPress)-style template compatibility parts. In those
 template parts, I display something very, very similar to a post thumbnail
 or custom header. I want to use the "Featured Image" metabox on the Post
 screen to set that image.

 If I use the plugin on a theme that doesn't support post thumbnails, the
 metabox correctly doesn't appear, and so users have no way of choosing a
 featured image. While there are ways around this -- manual conditional
 registering of the Featured Image metabox, creating my own metabox, or
 calling add_theme_support/remove_theme_support like a toggle -- none of
 them are particularly elegant.

 While current_theme_supports has a return filter, it's not reached by all
 code execution paths. The attached patch reworks the function so that the
 return value is always passed through the filter.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21912>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list