You can remove the type=’*’ attributes and values from wp_enqueue’ed scripts and styles, using respective *_loader_tag hooks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | add_action( 'wp_enqueue_scripts', 'myplugin_enqueue' ); function myplugin_enqueue() { // wp_register_script(... // wp_enqueue_script(... } add_filter('style_loader_tag', 'myplugin_remove_type_attr', 10, 2); add_filter('script_loader_tag', 'myplugin_remove_type_attr', 10, 2); function myplugin_remove_type_attr($tag, $handle) { return preg_replace( "/type=['\"]text\/(javascript|css)['\"]/", '', $tag ); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.