[wp-trac] [WordPress Trac] #56975: Replace the internal `WP_Theme_JSON_Resolver::theme_has_support()` with a public function

WordPress Trac noreply at wordpress.org
Tue Jan 24 13:35:56 UTC 2023


#56975: Replace the internal `WP_Theme_JSON_Resolver::theme_has_support()` with a
public function
-------------------------------------------------+-------------------------
 Reporter:  oandregal                            |       Owner:
                                                 |  hellofromTonya
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.2
Component:  Themes                               |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  gutenberg-merge has-patch has-unit-  |     Focuses:
  tests has-testing-info                         |  performance
-------------------------------------------------+-------------------------

Comment (by spacedmonkey):

 > Do you agree with this lean static variable approach @spacedmonkey?

 I am not 100% sure about static variable. I don't like the DUX of cache
 clearing with a param on a function. That feels ugly.

 I think maybe we leave it as is and maybe create a new ticket to discuss
 caching in my detail. There are lots of options.
 - Transients.
 - Object cache.
 - Static variables
 - Global variables

 All of which have their pros and cons. I think the end goal here is end up
 in a preseient cache across requests, but this has never been defined as
 the goal.

 I could get behind any solution that makes the internals changable later.
 We need a `wp_theme_has_theme_json` function and a
 `wp_theme_has_theme_json_cache_clear` function ( named however you want).
 If developers call, `wp_theme_has_theme_json_cache_clear` if clears that
 cache. That way we can change it however we want later. Any solution where
 we forcing ourselves to use a param, is just making bad DUX IMO.

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


More information about the wp-trac mailing list