From 93d6e51656c4d2d308e9c4fe2dff27964eda719b Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Mon, 9 Dec 2024 10:45:10 +1100 Subject: [PATCH 1/3] Update docblocks for `wp_get_global_stylesheet` and `WP_Theme_JSON::get_stylesheet`. --- src/wp-includes/class-wp-theme-json.php | 2 ++ src/wp-includes/global-styles-and-settings.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index cb48672c438bb..7d1216a4515d3 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -1317,6 +1317,8 @@ public function get_settings() { * - `variables`: only the CSS Custom Properties for presets & custom ones. * - `styles`: only the styles section in theme.json. * - `presets`: only the classes for the presets. + * - `base-layout-styles`: only the base layout styles. + * - `custom-css`: only the custom CSS. * @param string[] $origins A list of origins to include. By default it includes VALID_ORIGINS. * @param array $options { * Optional. An array of options for now used for internal purposes only (may change without notice). diff --git a/src/wp-includes/global-styles-and-settings.php b/src/wp-includes/global-styles-and-settings.php index 34fc28694be64..a34f8cc65ac63 100644 --- a/src/wp-includes/global-styles-and-settings.php +++ b/src/wp-includes/global-styles-and-settings.php @@ -142,7 +142,7 @@ function wp_get_global_styles( $path = array(), $context = array() ) { * @since 6.6.0 Resolves relative paths in theme.json styles to theme absolute paths. * * @param array $types Optional. Types of styles to load. - * It accepts as values 'variables', 'presets', 'styles', 'base-layout-styles'. + * It accepts as values 'variables', 'presets', 'styles', 'base-layout-styles', 'custom-css'. * If empty, it'll load the following: * - for themes without theme.json: 'variables', 'presets', 'base-layout-styles'. * - for themes with theme.json: 'variables', 'presets', 'styles'. From 4a993c138e936c5116b01c8344c4ec52b52154fa Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Mon, 9 Dec 2024 11:28:51 +1100 Subject: [PATCH 2/3] Add context to deprecated function docblock. --- src/wp-includes/deprecated.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index 348267b6a5b80..09d7867156b3f 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -6316,7 +6316,7 @@ function wp_interactivity_process_directives_of_interactive_blocks( array $parse * Gets the global styles custom CSS from theme.json. * * @since 6.2.0 - * @deprecated 6.7.0 Use {@see 'wp_get_global_stylesheet'} instead. + * @deprecated 6.7.0 Use {@see 'wp_get_global_stylesheet'} instead for top-level custom CSS, or {@see 'WP_Theme_JSON::get_styles_for_block'} for block-level custom CSS. * * @return string The global styles custom CSS. */ From fbea18a26237c6b42016b3c921a1fbb06b747e5b Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Mon, 9 Dec 2024 11:33:02 +1100 Subject: [PATCH 3/3] Point to source of truth for types. --- src/wp-includes/global-styles-and-settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/global-styles-and-settings.php b/src/wp-includes/global-styles-and-settings.php index a34f8cc65ac63..b75dd79ea68c5 100644 --- a/src/wp-includes/global-styles-and-settings.php +++ b/src/wp-includes/global-styles-and-settings.php @@ -142,7 +142,7 @@ function wp_get_global_styles( $path = array(), $context = array() ) { * @since 6.6.0 Resolves relative paths in theme.json styles to theme absolute paths. * * @param array $types Optional. Types of styles to load. - * It accepts as values 'variables', 'presets', 'styles', 'base-layout-styles', 'custom-css'. + * See {@see 'WP_Theme_JSON::get_stylesheet'} for all valid types. * If empty, it'll load the following: * - for themes without theme.json: 'variables', 'presets', 'base-layout-styles'. * - for themes with theme.json: 'variables', 'presets', 'styles'.