[wp-trac] [WordPress Trac] #22080: add_theme_support should merge post-thumbnail post types by default (currently stomps)

WordPress Trac noreply at wordpress.org
Thu Oct 22 21:58:54 UTC 2015


#22080: add_theme_support should merge post-thumbnail post types by default
(currently stomps)
-------------------------------------+-----------------------------
 Reporter:  alexkingorg              |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Post Thumbnails          |     Version:  2.9
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |     Focuses:
-------------------------------------+-----------------------------

Comment (by jmichaelward):

 Hello everyone,

 I am proposing revisiting this ticket, because I believe the current
 implementation of add_theme_support( 'post-thumbnails' ) to be somewhat
 confusing at best, and at worst, it may introduce conflicts between
 plugins and themes.

 As an example, I was reviewing the current version of WooCommerce (version
 2.4.7 at the time of this writing) when I noticed that line 348 of
 woocommerce.php declares a function titled add_thumbnail_support(). This
 function runs a check to see whether the currently-installed theme
 supports post thumbnails. If it doesn't, the plugin adds post thumbnail
 theme support for all installed post types, then attaches that theme
 support the WooCommerce product post type, as well.

 This could be potentially confusing to an end user who did not have post
 thumbnail support previously activated in their theme, and upon activated
 WooCommerce, now sees the option to add featured images to all of their
 pages, posts, and any other custom post type that is registered in the
 system. Furthermore, should they choose to add a featured image to those
 previously-unsupported post types, confusion may be compounded when they
 do not see those images displayed on the front-end.

 Currently, add_theme_support( 'post-thumbnail' ) accepts an additional
 array value for which post types should include post thumbnail support.
 Ideally, plugin authors would be able to do something along these lines:

 add_theme_support( 'post-thumbnails', array( 'my_custom_post_type' );

 ...which would append their custom post type to an array of other post
 types that have post thumbnail support enabled. If none are enabled, this
 would register post thumbnail support and assign it to that post type. If,
 at that time, the end user installs another plugin or a theme that adds
 specified post thumbnail support in this manner, there would be no
 conflicts as to which post types would be displaying the option to attach
 a featured image.

 I just came across this issue today, so I don't have a proposed resolution
 just yet, but I do think we can improve upon the previously solutions that
 have been proposed. I'll plan to write something up and submit it in the
 next few days. In the meantime, I wanted to re-open this issue for
 discussion.

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


More information about the wp-trac mailing list