Question

script type="text/javascript" is optional in HTML5 and all browsers (even old ones) recognize JavaScript without it. I am building an HTML5 site and want my script output to be consistent. However, scripts that use the WordPress enqueue function are printed withtype="text/javascript".

CSS is also printed with type="text/css", which is also not needed.

I can't find a filter to remove those properties. Is there one?

Was it helpful?

Solution

This is hardcoded in WP_Scripts->do_item() method ( source ) and probably same for styles. So it cannot be filtered.

As alternative you can extend class with modified version of this method and replace instance in global $wp_scripts variable.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top