Skip to content

Commit 98aa939

Browse files
Return early if no custom CSS class is provided
Add early return for empty custom CSS class string
1 parent 57bd3b6 commit 98aa939

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/wp-includes/block-supports/custom-css.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ function wp_enqueue_block_custom_css() {
7979
*/
8080
function wp_render_custom_css_class_name( $block_content, $block ) {
8181
$class_string = $block['attrs']['className'] ?? '';
82+
83+
/* If there is no class string, there is no custom CSS class to add, so return early. */
84+
if ( '' === $class_string ) {
85+
return $block_content;
86+
}
87+
8288
preg_match( '/\bwp-custom-css-\S+\b/', $class_string, $matches );
8389

8490
if ( empty( $matches ) ) {

0 commit comments

Comments
 (0)