mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 07:05:37 +01:00
Editor: skip outputting base layout rules if content and wide size values don’t exist.
Skip outputting layout rules that reference content and wide sizes CSS variables, if no layout sizes exist in the current `theme.json`. Props andrewserong. Reviewed by jorbin. Merges [57948] to the 6.5 branch. Fixes #60936. Built from https://develop.svn.wordpress.org/branches/6.5@58056 git-svn-id: http://core.svn.wordpress.org/branches/6.5@57521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
899608b6be
commit
c164facc1d
@ -1388,6 +1388,7 @@ class WP_Theme_JSON {
|
||||
*
|
||||
* @since 6.1.0
|
||||
* @since 6.3.0 Reduced specificity for layout margin rules.
|
||||
* @since 6.5.1 Only output rules referencing content and wide sizes when values exist.
|
||||
*
|
||||
* @param array $block_metadata Metadata about the block to get styles for.
|
||||
* @return string Layout styles for the block.
|
||||
@ -1548,6 +1549,16 @@ class WP_Theme_JSON {
|
||||
! empty( $base_style_rule['rules'] )
|
||||
) {
|
||||
foreach ( $base_style_rule['rules'] as $css_property => $css_value ) {
|
||||
// Skip rules that reference content size or wide size if they are not defined in the theme.json.
|
||||
if (
|
||||
is_string( $css_value ) &&
|
||||
( str_contains( $css_value, '--global--content-size' ) || str_contains( $css_value, '--global--wide-size' ) ) &&
|
||||
! isset( $this->theme_json['settings']['layout']['contentSize'] ) &&
|
||||
! isset( $this->theme_json['settings']['layout']['wideSize'] )
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( static::is_safe_css_declaration( $css_property, $css_value ) ) {
|
||||
$declarations[] = array(
|
||||
'name' => $css_property,
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.5.3-alpha-58050';
|
||||
$wp_version = '6.5.3-alpha-58056';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user