diff --git a/src/wp-includes/shortcodes.php b/src/wp-includes/shortcodes.php index d16227ea3c..a34f530620 100644 --- a/src/wp-includes/shortcodes.php +++ b/src/wp-includes/shortcodes.php @@ -399,7 +399,7 @@ function do_shortcodes_in_html_tags( $content, $ignore_html ) { if ( $count > 0 ) { // Sanitize the shortcode output using KSES. $new_attr = wp_kses_one_attr( $new_attr, $elname ); - if ( '' !== $new_attr ) { + if ( '' !== trim( $new_attr ) ) { // The shortcode is safe to use now. $attr = $new_attr; } diff --git a/tests/phpunit/tests/shortcode.php b/tests/phpunit/tests/shortcode.php index 44abc2754f..c43313c61a 100644 --- a/tests/phpunit/tests/shortcode.php +++ b/tests/phpunit/tests/shortcode.php @@ -418,6 +418,14 @@ EOF; '