[wp-trac] [WordPress Trac] #22080: add_theme_support should merge post-thumbnail post types by default (currently stomps)
WordPress Trac
wp-trac at lists.automattic.com
Tue Oct 2 19:45:00 UTC 2012
#22080: add_theme_support should merge post-thumbnail post types by default
(currently stomps)
-----------------------------+-----------------------------
Reporter: alexkingorg | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Post Thumbnails
Version: trunk | Severity: normal
Keywords: has-patch |
-----------------------------+-----------------------------
As documented in the Codex:
http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
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:
https://gist.github.com/3822786
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).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22080>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list