Remove type=”text/javascript” in Jetpack scripts
-
I have these errors in W3c validator: “The type attribute is unnecessary for JavaScript resources.”
I want to remove the type=”text/javascript” in the script generated by Jetpack.
I already have these codes placed in the functions.php, but unfortunately its not enough.
add_filter(‘style_loader_tag’, ‘codeless_remove_type_attr’, 10, 2);
add_filter(‘script_loader_tag’, ‘codeless_remove_type_attr’, 10, 2);
function codeless_remove_type_attr($tag, $handle) {
return preg_replace( “/type=[‘\”]text\/(javascript|css)[‘\”]/”, ”, $tag );
}
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Remove type=”text/javascript” in Jetpack scripts’ is closed to new replies.