diff --git a/src/wp-includes/class.wp-scripts.php b/src/wp-includes/class.wp-scripts.php index 9d1b706343..1b4abd8166 100644 --- a/src/wp-includes/class.wp-scripts.php +++ b/src/wp-includes/class.wp-scripts.php @@ -149,7 +149,11 @@ class WP_Scripts extends WP_Dependencies { * @since 3.4.0 */ public function init() { - if ( ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) { + if ( + function_exists( 'is_admin' ) && ! is_admin() + && + function_exists( 'current_theme_supports' ) && ! current_theme_supports( 'html5', 'script' ) + ) { $this->type_attr = " type='text/javascript'"; } @@ -220,10 +224,19 @@ class WP_Scripts extends WP_Dependencies { return $output; } - echo "type_attr}>\n"; // CDATA and type="text/javascript" is not needed for HTML 5. - echo "/* type_attr}>\n"; + + // CDATA is not needed for HTML 5. + if ( $this->type_attr ) { + echo "/* */\n"; + + if ( $this->type_attr ) { + echo "/* ]]> */\n"; + } + echo "\n"; return true; diff --git a/src/wp-includes/class.wp-styles.php b/src/wp-includes/class.wp-styles.php index 4c1d4f53a1..17bfef8b2e 100644 --- a/src/wp-includes/class.wp-styles.php +++ b/src/wp-includes/class.wp-styles.php @@ -117,7 +117,11 @@ class WP_Styles extends WP_Dependencies { * @since 2.6.0 */ public function __construct() { - if ( ! is_admin() && ! current_theme_supports( 'html5', 'style' ) ) { + if ( + function_exists( 'is_admin' ) && ! is_admin() + && + function_exists( 'current_theme_supports' ) && ! current_theme_supports( 'html5', 'style' ) + ) { $this->type_attr = " type='text/css'"; }