diff --git a/packages/style-engine/class-wp-style-engine.php b/packages/style-engine/class-wp-style-engine.php index 5687a2f422186e..4b06bcd653fd0c 100644 --- a/packages/style-engine/class-wp-style-engine.php +++ b/packages/style-engine/class-wp-style-engine.php @@ -242,7 +242,8 @@ public function generate( $block_styles ) { foreach ( $css_rules as $rule => $value ) { $filtered_css = esc_html( safecss_filter_attr( "{$rule}: {$value}" ) ); if ( ! empty( $filtered_css ) ) { - $css_output .= $filtered_css . '; '; + $css_output_suffix = str_ends_with( $filtered_css, ';' ) ? ' ' : '; '; + $css_output .= $filtered_css . $css_output_suffix; } } }