diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index 5d52a998fadcb7..234d9c2e057e11 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -46,7 +46,7 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support if ( is_array( $gap_value ) ) { $gap_value = isset( $gap_value['top'] ) ? $gap_value['top'] : null; } - if ( $gap_value && ! $should_skip_gap_serialization ) { + if ( null !== $gap_value && ! $should_skip_gap_serialization ) { array_push( $layout_styles, array( @@ -129,7 +129,7 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support if ( is_array( $gap_value ) ) { $gap_value = isset( $gap_value['top'] ) ? $gap_value['top'] : null; } - if ( $gap_value && ! $should_skip_gap_serialization ) { + if ( null !== $gap_value && ! $should_skip_gap_serialization ) { // Get spacing CSS variable from preset value if provided. if ( is_string( $gap_value ) && str_contains( $gap_value, 'var:preset|spacing|' ) ) { $index_to_splice = strrpos( $gap_value, '|' ) + 1; @@ -198,7 +198,7 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support } $gap_value = trim( $combined_gap_value ); - if ( $gap_value && ! $should_skip_gap_serialization ) { + if ( null !== $gap_value && ! $should_skip_gap_serialization ) { $layout_styles[] = array( 'selector' => $selector, 'declarations' => array( 'gap' => $gap_value ), diff --git a/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php b/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php index 4f9265657ab106..56a71c68cf34b2 100644 --- a/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php +++ b/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php @@ -1345,7 +1345,7 @@ protected function get_layout_styles( $block_metadata ) { } } - if ( $block_gap_value ) { + if ( null !== $block_gap_value ) { foreach ( $layout_definitions as $layout_definition_key => $layout_definition ) { // Allow skipping default layout for themes that opt-in to block styles, but opt-out of blockGap. if ( ! $has_block_gap_support && 'default' === $layout_definition_key ) {