[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 04:17:51 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 jmichaelward):

 @flixos90, I took your suggestion and broke out post-thumbnails into its
 own case in my switch block in the latest patch,
 [https://core.trac.wordpress.org/attachment/ticket/36666/36666.2.diff
 36666.2.diff]. I'm not crazy about the repeating logic blocks that are
 shared with the html5/post-formats case, so maybe there's a smarter way to
 organize this.

 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.

 Per your previous suggestions, I also removed the case block for the other
 `theme_support` features. Let me know what you think.

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


More information about the wp-trac mailing list