add_theme_support should merge post-thumbnail post types by default (currently stomps)
|Reported by:||alexkingorg||Owned by:|
|Component:||Post Thumbnails||Keywords:||has-patch 3.6-early|
As documented in the Codex:
you can pass a second param to add_theme_support( 'post-thumbnails' ) to specify the post types you want support enabled for. I expected any post types I passed in to be added to the currently specified post types, instead the passed value stomps the existing value. This means that if you create plugin that registers a post type and enables post-thumbnails for it, you need to write code like this:
instead of a simple:
add_theme_support( 'post-thumbnails', array( 'my-new-post-type' ) );
The latter makes more sense to me, and I think it's likely other devs might make the same mistake and accidentally stomp on the previous value for post-thumbnails.
The attached patch enables a merge or stomp behavior for post-thumbnails. It defaults to "merge". Passing a bool true as a 3rd param will cause the second param to replace the existing value (current behavior).
Change History (26)
comment:10 in reply to: ↑ 9 @scribu — 3 years ago
comment:15 @nacin — 3 years ago
- Keywords 3.6-early added; 2nd-opinion removed
- Milestone changed from Awaiting Review to Future Release
- Type changed from defect (bug) to enhancement
- Version changed from trunk to 2.9