How to remove type attributes?
-
Hi,
i tried to remove the type attribute from the style and script tags with the following code snippet://* Remove type tag from script and style 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 ); }
In the un-cached version it works. It seems so that autoptimize add those attributes to the cached website.
On validator.w3.org i get some warnings because those attributes are no longer needed.
Examples:Warning: The type attribute for the style element is not needed and should be omitted.
Warning: The type attribute is unnecessary for JavaScript resources.
The page I need help with: [log in to see the link]
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘How to remove type attributes?’ is closed to new replies.