[wp-trac] [WordPress Trac] #36666: Enhance `remove_theme_support()` so that it can take additional arguments
WordPress Trac
noreply at wordpress.org
Wed Apr 27 09:06:33 UTC 2016
#36666: Enhance `remove_theme_support()` so that it can take additional arguments
------------------------------------+------------------------------
Reporter: flixos90 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses:
------------------------------------+------------------------------
Comment (by flixos90):
Replying to [comment:8 jmichaelward]:
> That said, I realized that there was a new method introduced in
WordPress 4.5 called `get_post_types_by_support()`, which I could take
advantage of in this case. If `$_wp_theme_features['post-thumbnails']` is
set to a boolean value, we simply reset it to an array and populate that
array with the current thumbnail post type support. Then, we process the
value just as we did with html5/post-formats.
>
> Ideally, we could perform this check before the switch block, but
because there is a naming discrepancy in the reference to post thumbnails
(e.g., `post-thumbnails` and `thumbnails`), I'm not sure whether we can
reconcile at this point.
>
> That said, the method now appears to correctly remove a post type's
theme support for post thumbnails if they were previously added without an
array value, and I think this is at a point where it could be tested.
Unfortunately we cannot use the `get_post_types_by_support()` function
since it is targeted add the individual post type support for features
like `title`, `editor`, `comments`, `thumbnails` and so on - it doesn't
have to do with theme support. And at the point where most people would
call `remove_theme_support()`, the post types will not have been
registered yet, so we need to figure out another way to handle this. I
think it's simply not possible to remove a specific post type from support
if its current value is just a `true`.
The same applies to `post-formats` - this value can be `true` as well, so
we need to ensure we handle this.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36666#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list