[wp-trac] [WordPress Trac] #36666: Enhance `remove_theme_support()` so that it can take additional arguments

WordPress Trac noreply at wordpress.org
Tue Apr 26 00:33:23 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:  needs-patch  |     Focuses:
-------------------------+------------------------------

Comment (by jmichaelward):

 @flixos90 I attached a first pass at this, which will need to be fleshed
 out a bit more for various types of theme support.

 Notes:

 1. Optional array values were added to `remove_theme_support()` and
 `_remove_theme_support()`.

 2. I moved up the early bail in `_remove_theme_support()` if the passed
 feature was not yet added to the theme.

 3. I added a separate switch statement if arguments were passed to the
 function, so those can be evaluated first. HTML5, Post Format, and Post
 Thumbnail support are all structured the same, so they share the same set
 of code for removing arguments.

 4. Upon reviewing the Codex, I noted some features that do not have
 optional array parameters. I stubbed out those that do (`custom-logo` and
 `widgets`), but left them stubbed for now, as it's not clear to me whether
 a single option can be simply removed, or if it needs to be reassigned a
 default depending on its type. I'm assuming the latter.

 5. For non-argument removal, the `custom-header-uploads` case had a
 condition. This was previously placed higher in the function and in a
 separate switch statement. I don't think this was necessary, so I grouped
 it with the second switch statement. Obviously, we'll want to test to
 confirm that this is the case.

 Let me know how this first pass looks, whether any adjustments are needed
 to the work that is done here, and how best to approach the remaining
 theme features, and assuming everything looks good, I'll move forward from
 this patch.

 Thanks.

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


More information about the wp-trac mailing list