diff --git a/wp-includes/class.wp-styles.php b/wp-includes/class.wp-styles.php index 4a54b71676..927a7e7307 100644 --- a/wp-includes/class.wp-styles.php +++ b/wp-includes/class.wp-styles.php @@ -87,10 +87,11 @@ class WP_Styles extends WP_Dependencies { if ( $this->do_concat ) { $this->print_html .= $tag; - $this->print_html .= $this->print_inline_style( $handle, false ); + if ( $inline_style = $this->print_inline_style( $handle, false ) ) + $this->print_html .= sprintf( "\n", $inline_style ); } else { echo $tag; - echo $this->print_inline_style( $handle, false ); + $this->print_inline_style( $handle ); } return true; diff --git a/wp-includes/functions.wp-styles.php b/wp-includes/functions.wp-styles.php index c3569927fb..d97667cf88 100644 --- a/wp-includes/functions.wp-styles.php +++ b/wp-includes/functions.wp-styles.php @@ -14,7 +14,7 @@ * Passing an empty array to $handles prints the queue, * passing an array with one string prints that style, * and passing an array of strings prints those styles. - * + * * @see do_action() Calls 'wp_print_styles' hook. * @global WP_Styles $wp_styles The WP_Styles object for printing styles. * @@ -71,6 +71,11 @@ function wp_add_inline_style( $handle, $data ) { $wp_styles = new WP_Styles(); } + if ( false !== stripos( $data, '' ) ) { + _doing_it_wrong( __FUNCTION__, 'Do not pass #is', '$1', $data ) ); + } + return $wp_styles->add_inline_style( $handle, $data ); }