[wp-trac] [WordPress Trac] #49406: Introduce register_theme_support method

WordPress Trac noreply at wordpress.org
Sun Jun 7 20:53:58 UTC 2020


#49406: Introduce register_theme_support method
--------------------------------------+-----------------------
 Reporter:  kadamwhite                |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  5.5
Component:  Themes                    |     Version:  5.0
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  rest-api
--------------------------------------+-----------------------

Comment (by TimothyBlynJacobs):

 I've created a PR for a `register_theme_feature()` function. I opted for
 `register_theme_feature` instead of `register_theme_support()` because I
 think it is more clear that you are registering the feature that you can
 then add support for with `add_theme_support( $feature )`.

 It follows the pattern of `register_meta`.

 I've switched over all the core theme features to use the new API. I was
 also able to allow `post-formats` to work with this mechanism.

 Cc'ing @sagarprajapati and @williampatton as component maintainers. Also
 cc'ing @spacedmonkey.

 > Registering is just describing it.

 Yep registration just describes the feature.

 > I'd also suggest that we make sure theme support can be added before
 it's registered -- so that a late register doesn't break legacy
 declarations of adding it.

 Yep this works. We're not checking against this in `add_theme_support` or
 requiring that the theme feature be registered before being used in any
 way.

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


More information about the wp-trac mailing list