[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
Fri Jan 20 11:01:50 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 gutenberg-merge has- | Focuses:
patch has-unit-tests has-testing-info | performance
-------------------------------------------------+-------------------------
Comment (by spacedmonkey):
My recommendation is the following.
- Removing caching from `wp_theme_has_theme_json` function.
- Limit the usage of `wp_theme_has_theme_json` where possible, possibly
just to bootstrap functions.
- Implement a `has_theme_json` method on `WP_Theme` class and use existing
caching built [https://github.com/WordPress/wordpress-
develop/blob/675fe390b9c8d75795ff10bb5c8d8728be4ba11f/src/wp-includes
/class-wp-theme.php#L745-L747 into] the theme class. This class already
has a way of [https://github.com/WordPress/wordpress-
develop/blob/675fe390b9c8d75795ff10bb5c8d8728be4ba11f/src/wp-includes
/class-wp-theme.php#L225-L233 opt-in] into make the cache persistent.
Cache invalidation is [https://github.com/WordPress/wordpress-
develop/blob/c169050267fe983d39005d9292927f0674e57d16/src/wp-
includes/theme.php#L134-L148 already in place].
- `has_theme_json` in places where have a `WP_Theme` instance in use
already. [https://github.com/WordPress/wordpress-
develop/blob/675fe390b9c8d75795ff10bb5c8d8728be4ba11f/src/wp-includes
/class-wp-theme-json-resolver.php#L420 Example 1],
[https://github.com/WordPress/wordpress-
develop/blob/675fe390b9c8d75795ff10bb5c8d8728be4ba11f/src/wp-includes
/class-wp-theme-json-resolver.php#L242 example 2].
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56975#comment:71>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list