[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 13:57:17 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:
------------------------------------+------------------------------
Changes (by flixos90):

 * keywords:  needs-patch => has-patch dev-feedback


Comment:

 Replying to [comment:3 jmichaelward]:
 Thanks for this initial patch. I added some comments below (some of which
 we should probably discuss before improving the patch).

 > Optional array values were added to `remove_theme_support()` and
 `_remove_theme_support()`.
 We might consider to also support `$args` to be a string (as in
 `remove_theme_support( 'post-thumbnails', 'post' )`). Not sure about that
 though since the other `theme_support` functions don't support it either.
 > 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.
 Do we really need the additional switch statement? I feel like one should
 be sufficient. We can then check, for each theme feature where we need
 this, whether `$args` is used or not. About the grouping, post formats and
 HTML5 can be together, but post thumbnails work a little differently (keep
 in mind that this feature might just have the value `true` in which case
 we can't remove anything from it).
 > 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.
 I think we don't need to consider features like these in here at all.
 Basically if you provide `$args` for one these features, just ignore them
 as it's not meant to be used.

 Another thing that we need to think about is whether we wanna explicitly
 include the `$args` parameter in the function signature or use
 `func_get_args()` like in the other theme support functions. I'm not sure
 why the other functions handle it like that in the first place, so it
 would be good to get some feedback by someone who has been involved with
 these for a longer time.

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


More information about the wp-trac mailing list