[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
Thu Jan 19 00:50:42 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:  dev-feedback needs-testing-info      |     Focuses:
  gutenberg-merge                                |  performance
-------------------------------------------------+-------------------------

Comment (by azaozz):

 Sorry I'm late to the party.

 > Fatal error: Uncaught Error: Call to undefined function wp_cache_get()
 in /wp-includes/global-styles-and-settings.php on line 285

 > wp_cache_get() is defined either in wp-includes/cache.php, or in an
 external object cache. wp_start_object_cache() determines which of these
 should be loaded.
 >
 > This is called in two places: wp-settings.php, and wp-includes/ms-
 settings.php.

 @Otto42 @costdev @hellofromTonya The problem is with how `load-styles.php`
 and `load-scripts.php` work. They do not load WP, only load `script-
 loader.php` and use it as a whitelist to get the URLs to the scripts and
 stylesheets. The dependencies and load order have already been
 "calculated" beforehand. `load-styles.php` and `load-scripts.php` only
 concatenate and output (stream) the actual js and css files whose names
 are passed in `$_GET` .

 Because WP is not loaded, any functions that are called from script-loader
 are stubbed. None of these functions is needed, only the URLs to scripts
 and stylesheets. The stubs are in
 https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/includes/noop.php.

 Looking at [55086], seems `wp_theme_has_theme_json()` needs to be stubbed
 too, and the revert in [55092] added again?

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


More information about the wp-trac mailing list