WordPress/wp-admin
hellofromTonya 8ddb28368a Themes: Introduce wp_theme_has_theme_json() for public consumption.
Adds `wp_theme_has_theme_json()` for public consumption, to replace the private internal Core-only `WP_Theme_JSON_Resolver::theme_has_support()` method. This new global function checks if a theme or its parent has a `theme.json` file.

For performance, results are cached as an integer `1` or `0` in the `'theme_json'` group with `'wp_theme_has_theme_json'` key. This is a non-persistent cache. Why? To make the derived data from `theme.json` is always fresh from the potential modifications done via hooks that can use dynamic data (modify the stylesheet depending on some option, settings depending on user permissions, etc.).

Also adds a new public function `wp_clean_theme_json_cache()` to clear the cache on `'switch_theme'` and `start_previewing_theme'`.

References:
* [https://github.com/WordPress/gutenberg/pull/45168 Gutenberg PR 45168] Add `wp_theme_has_theme_json` as a public API to know whether a theme has a `theme.json`.
* [https://github.com/WordPress/gutenberg/pull/45380 Gutenberg PR 45380] Deprecate `WP_Theme_JSON_Resolver:theme_has_support()`.
* [https://github.com/WordPress/gutenberg/pull/46150 Gutenberg PR 46150] Make `theme.json` object caches non-persistent.
* [https://github.com/WordPress/gutenberg/pull/45979 Gutenberg PR 45979] Don't check if constants set by `wp_initial_constants()` are defined.
* [https://github.com/WordPress/gutenberg/pull/45950 Gutenberg PR 45950] Cleaner logic in `wp_theme_has_theme_json`.

Follow-up to [54493], [53282], [52744], [52049], [50959].

Props oandregal, afragen, alexstine, aristath, azaozz, costdev, flixos90, hellofromTonya, mamaduka, mcsf, ocean90, spacedmonkey.
Fixes #56975.
Built from https://develop.svn.wordpress.org/trunk@55086


git-svn-id: http://core.svn.wordpress.org/trunk@54619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-18 11:40:10 +00:00
..
css General: revert [55045]. 2023-01-11 09:17:21 +00:00
images Help/About: Update About section images. 2022-10-25 14:56:17 +00:00
includes Upgrade/Install: Revert a temporary conditional for testing the Rollbacks feature project. 2023-01-12 00:19:12 +00:00
js Docs: Align spelling with American English. 2023-01-10 09:30:13 +00:00
maint Security: Additional translations of salt default phrase. 2022-10-04 03:59:13 +00:00
network Networks and Sites: Mark required fields as such in New User Form. 2023-01-02 22:50:15 +00:00
user
about.php Text Changes: Replace "Full site editing" with "Site Editor". 2022-11-10 09:40:16 +00:00
admin-ajax.php Coding Standards: Remove extra space in `wp-admin/admin-ajax.php`. 2022-05-07 16:21:18 +00:00
admin-footer.php Coding Standards: Simplify a condition in `wp-admin/admin-footer.php`. 2021-06-01 11:30:57 +00:00
admin-functions.php
admin-header.php Docs: Add missing description for `$typenow` global in various functions. 2022-04-04 18:39:01 +00:00
admin-post.php Administration: Require a valid action parameter to be set for `admin-ajax.php` requests. 2022-03-02 15:00:11 +00:00
admin.php Docs: Add missing description for `$taxnow` global in various functions. 2022-04-04 18:43:02 +00:00
async-upload.php Media: Remove target blank attribute from media uploader edit links. 2022-01-27 22:17:00 +00:00
authorize-application.php Docs: Various corrections and improvements to inline documentation. 2022-08-04 14:52:11 +00:00
comment.php Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:25:03 +00:00
credits.php Help/About: Update copy & style for About page and subpages. 2022-10-18 15:10:12 +00:00
custom-background.php
custom-header.php
customize.php Coding Standards: Always use parentheses when instantiating an object. 2022-11-29 15:51:14 +00:00
edit-comments.php Help/About: Improve comments keyboard shortcuts HelpHub links. 2023-01-10 09:01:13 +00:00
edit-form-advanced.php Administration: Remove self-reference ("we") in WordPress Admin. 2022-04-11 11:42:04 +00:00
edit-form-blocks.php Themes: Introduce wp_theme_has_theme_json() for public consumption. 2023-01-18 11:40:10 +00:00
edit-form-comment.php Docs: Explicitly declare some globals for clarity. 2022-05-29 15:35:11 +00:00
edit-link-form.php Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:25:03 +00:00
edit-tag-form.php Networks and Sites: Officially remove global terms. 2022-09-20 02:51:09 +00:00
edit-tags.php Networks and Sites: Officially remove global terms. 2022-09-20 02:51:09 +00:00
edit.php Docs: Explicitly declare some globals for clarity. 2022-05-29 15:35:11 +00:00
erase-personal-data.php Help/about: Improve text in help tabs of the Personal Data Exporter/Eraser. 2022-04-14 14:46:07 +00:00
export-personal-data.php Help/about: Improve text in help tabs of the Personal Data Exporter/Eraser. 2022-04-14 14:46:07 +00:00
export.php Administration: Remove self-reference ("we") in WordPress Admin. 2022-04-11 11:42:04 +00:00
freedoms.php Help/About: Update About section images. 2022-10-25 14:56:17 +00:00
import.php Docs: Add a comment about the `$title` global usage in various admin files. 2021-07-22 13:53:00 +00:00
index.php Help/About: Improve typography in the `Welcome to your WordPress Dashboard!` text. 2021-11-03 03:16:57 +00:00
install-helper.php Docs: Fix typo and improve DocBlock formatting in `wp-admin/install-helper.php`. 2022-11-20 14:10:15 +00:00
install.php Upgrade/Install: Keep search engine checkbox value when reloading the Install screen. 2022-09-27 10:37:13 +00:00
link-add.php Docs: Add a comment about the `$title` global usage in various admin files. 2021-07-22 13:53:00 +00:00
link-manager.php Docs: Add a comment about the `$title` global usage in various admin files. 2021-07-22 13:53:00 +00:00
link-parse-opml.php
link.php Coding Standards: Apply some alignment fixes from `composer format`. 2021-07-27 19:01:59 +00:00
load-scripts.php Docs: Update a comment in `wp-admin/load-styles.php` per the documentation standards. 2021-12-12 14:52:02 +00:00
load-styles.php Docs: Update a comment in `wp-admin/load-styles.php` per the documentation standards. 2021-12-12 14:52:02 +00:00
media-new.php Docs: Add a comment about the `$title` global usage in various admin files. 2021-07-22 13:53:00 +00:00
media-upload.php Docs: Add examples of possible names for various hooks whose name contains a dynamic portion. 2021-03-07 12:32:09 +00:00
media.php Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:25:03 +00:00
menu-header.php Administration: Restore the correct escaping function for base64-encoded SVG icons in the admin menu. 2022-04-07 12:54:03 +00:00
menu.php Themes: Introduces block-based template parts for Classic themes. 2022-09-15 12:20:09 +00:00
moderation.php
ms-admin.php
ms-delete-site.php Text Changes: Improve the wording of the email sent to confirm site deletion. 2022-11-14 21:57:10 +00:00
ms-edit.php
ms-options.php
ms-sites.php
ms-themes.php
ms-upgrade-network.php
ms-users.php
my-sites.php General: Revert [54225]. 2022-09-20 08:19:10 +00:00
nav-menus.php Menus: Reset `menu_item_parent` to 0 when the parent is set to the item itself. 2022-12-14 22:54:14 +00:00
network.php Docs: Add a comment about the `$title` global usage in various admin files. 2021-07-22 13:53:00 +00:00
options-discussion.php Coding Standards: Various brace indentation corrections. 2022-11-26 21:01:17 +00:00
options-general.php Administration: Improve the wording of "Site Address" field description. 2022-10-25 14:22:12 +00:00
options-head.php
options-media.php Docs: Add a comment about the `$title` global usage in various admin files. 2021-07-22 13:53:00 +00:00
options-permalink.php Coding Standards: Clarify time units for various timeout or expiration values. 2022-09-09 08:16:18 +00:00
options-privacy.php Administration: Use a consistent capitalization in Privacy Policy related strings. 2023-01-17 21:34:12 +00:00
options-reading.php Docs: Use third-person singular verbs for various function descriptions, as per docblocks standards. 2022-09-02 06:58:09 +00:00
options-writing.php Docs: Add a comment about the `$title` global usage in various admin files. 2021-07-22 13:53:00 +00:00
options.php Options, Meta APIs: Improve error messages in Options Management Administration Screen. 2022-12-01 22:20:12 +00:00
plugin-editor.php Administration: Correct the escaping in documentation lookup for plugin and theme editor. 2022-07-22 11:33:10 +00:00
plugin-install.php Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:25:03 +00:00
plugins.php Help/About: Fix inconsistency in auto-updates help tabs. 2022-11-14 21:53:11 +00:00
post-new.php
post.php Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:25:03 +00:00
press-this.php
privacy-policy-guide.php Administration: Remove self-reference ("we") in WordPress Admin. 2022-04-11 11:42:04 +00:00
privacy.php Help/About: Update About section images. 2022-10-25 14:56:17 +00:00
profile.php
revision.php Coding Standards: Use strict comparison in `wp-admin/revision.php`. 2022-01-07 16:47:00 +00:00
setup-config.php Upgrade/Install: Use "placeholder" for example values in setup-config.php. 2022-09-19 23:55:09 +00:00
site-editor.php Themes: Introduce wp_theme_has_theme_json() for public consumption. 2023-01-18 11:40:10 +00:00
site-health-info.php Site Health: Internationalizes count in the info section headings. 2021-11-01 22:36:59 +00:00
site-health.php Administration: Remove `role="img"` from decorative SVG images. 2022-11-01 11:05:16 +00:00
term.php General: Replace all `esc_url_raw()` calls in core with `sanitize_url()`. 2022-06-01 18:14:10 +00:00
theme-editor.php Coding Standards: Various brace indentation corrections. 2022-11-26 21:01:17 +00:00
theme-install.php Help/About: Remove an unwanted whitespace in a Theme Install screen help tab string. 2022-09-20 21:14:09 +00:00
themes.php Help/About: Fix inconsistency in auto-updates help tabs. 2022-11-14 21:53:11 +00:00
tools.php Docs: Add a comment about the `$title` global usage in various admin files. 2021-07-22 13:53:00 +00:00
update-core.php Coding Standards: Use consistent markup for line break tags on `update-core.php`. 2022-11-29 21:30:11 +00:00
update.php Docs: Add a comment about the `$title` global usage in various admin files. 2021-07-22 13:53:00 +00:00
upgrade-functions.php
upgrade.php General: Replace all `esc_url_raw()` calls in core with `sanitize_url()`. 2022-06-01 18:14:10 +00:00
upload.php Help/About: Typo correction in the Media Library help tab text. 2022-06-29 13:39:14 +00:00
user-edit.php Help/About: Improve comments keyboard shortcuts HelpHub links. 2023-01-10 09:01:13 +00:00
user-new.php Users: Add missing escaping on the Add New User screen. 2022-11-18 15:21:15 +00:00
users.php Help/About: Add help tab info for the "Send password reset" row action on Users screen. 2022-07-05 00:25:13 +00:00
widgets-form-blocks.php Editor: Update preload paths for post, site and widgets editors 2022-04-07 13:40:04 +00:00
widgets-form.php Administration: Add missing escaping for a few strings used as HTML attributes. 2022-11-14 11:50:15 +00:00
widgets.php Administration: Replace contracted verb forms for better consistency. 2022-03-22 19:59:04 +00:00