Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

script type="text/javascript" is optional in HTML5 and all browsers (even old ones) recognise 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 with type="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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
1  
Actually the style loader is a little better in that sense, you can hook onto style_loader_tag and adjust whatever parts of the link element(ie. <link =""> etc..) you like, there's unfortunately no equivalent for the script loader... :( –  t31os Jan 30 '11 at 16:39
    
Rarst, can you elaborate on how to do this? Thanks –  envysea Oct 1 '13 at 17:12
    
@envysea it's not something I would recommend doing in practice, especially if you not up to implementing and maintaining such solution on updates. –  Rarst Oct 1 '13 at 18:37
    
Open issue in progress at core.trac.wordpress.org/ticket/13592 ++ See also script_loader_src filter at wordpress.stackexchange.com/questions/47206/… –  here Nov 18 at 7:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.