General: Introduce all development mode.

Introduce the development mode `all` as a a cover-all mode for the existing `theme`, `plugin` and `core` development modes. Developers can use the `all` mode if they are developing both themes and plugins, for example.

Introduce the utility function `wp_in_development_mode()` allowing developers to detect the mode via a parameter. If the development mode is set to `all` this function will always return `true`. If the development mode is specific then only the chosen mode will return `true`.

Follow up to [56079,56042].

Props flixos90.
Fixes #57487.


Built from https://develop.svn.wordpress.org/trunk@56223


git-svn-id: http://core.svn.wordpress.org/trunk@55735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson
2023-07-13 00:29:26 +00:00
parent 724d2c9950
commit 94f92497ce
6 changed files with 38 additions and 10 deletions

View File

@@ -69,7 +69,7 @@ function wp_get_global_settings( $path = array(), $context = array() ) {
* Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
* developer's workflow.
*/
$can_use_cached = wp_get_development_mode() !== 'theme';
$can_use_cached = ! wp_in_development_mode( 'theme' );
$settings = false;
if ( $can_use_cached ) {
@@ -152,7 +152,7 @@ function wp_get_global_stylesheet( $types = array() ) {
* Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
* developer's workflow.
*/
$can_use_cached = empty( $types ) && wp_get_development_mode() !== 'theme';
$can_use_cached = empty( $types ) && ! wp_in_development_mode( 'theme' );
/*
* By using the 'theme_json' group, this data is marked to be non-persistent across requests.
@@ -251,7 +251,7 @@ function wp_get_global_styles_custom_css() {
* Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
* developer's workflow.
*/
$can_use_cached = wp_get_development_mode() !== 'theme';
$can_use_cached = ! wp_in_development_mode( 'theme' );
/*
* By using the 'theme_json' group, this data is marked to be non-persistent across requests.
@@ -360,7 +360,7 @@ function wp_theme_has_theme_json() {
* Ignore static cache when the development mode is set to 'theme', to avoid interfering with
* the theme developer's workflow.
*/
wp_get_development_mode() !== 'theme'
! wp_in_development_mode( 'theme' )
) {
return $theme_has_support[ $stylesheet ];
}