[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
Wed Jan 25 19:37:14 UTC 2023


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

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"55138" 55138]:
 {{{
 #!CommitTicketReference repository="" revision="55138"
 Themes: Add static cache variable to wp_theme_has_theme_json().

 For performance, a static variable is added to `wp_theme_has_theme_json()`
 to cache the boolean result of determining if a theme (or its parent) has
 a `theme.json` file.

 This cache avoids the overhead of calling `get_stylesheet_directory()` and
 `get_template_directory()` each time `wp_theme_has_theme_json()` is
 invoked.

 The cache is lean, non-persistent, and encapsulated within the function
 (i.e. function scope and not available externally).

 The cache is ignored when:
 * `WP_DEBUG` is on to avoid interrupting theme developer's workflow and
 for extender automated test suites.
 * `WP_RUN_CORE_TESTS` is on to ensure each Core test exercises the
 checking code.

 Follow-up to [55092], [55086].

 Props oandregal, azaozz, costdev, dmsnell, flixos90, hellofromTonya,
 Otto42, spacedmonkey.
 Fixes #56975.
 }}}

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


More information about the wp-trac mailing list