Title: Type attribute causing accessibility error
Last modified: December 16, 2021

---

# Type attribute causing accessibility error

 *  [kronikon](https://wordpress.org/support/users/kronikon/)
 * (@kronikon)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/type-attribute-causing-accessibility-error/)
 * Hello,
 * I’m using Polylang on a client website that got a grant from the government, 
   and it has to be 100% compliant with W3’s accessibility standards. One of the
   requirements is to pass the test on [https://validator.w3.org/nu/?doc=https%3A%2F%2Fpackmetal.eu%2F](https://validator.w3.org/nu/?doc=https%3A%2F%2Fpackmetal.eu%2F)
   but we are getting an error that appears to be related to your plugin:
 * Warning: The type attribute for the style element is not needed and should be
   omitted.
    From line 52, column 1; to line 52, column 23 t=xml” />↩<style type
   =”text/css”>BODY .
 * I tried to add this snippet to the functions.php file to get rid of the “type”
   attribute, but it didn’t work because the script is probably not added in the
   correct way through the “wp_enqueue_scripts” filter, therefore there is no way
   to remove it through the filters:
 * <?php
 * if ( ! function_exists( ‘prefix_remove_type_attr’ ) ) {
 *  /**
    * Remove ‘type’ Attribute of Scripts and Styles */ function prefix_remove_type_attr(
   $tag ) { return preg_replace( “/type=[‘\”]text\/(javascript|css)[‘\”]/”, ”, $
   tag ); }
 *  add_filter( ‘style_loader_tag’, ‘prefix_remove_type_attr’, 10 );
    add_filter(‘
   script_loader_tag’, ‘prefix_remove_type_attr’, 10 ); add_filter( ‘autoptimize_html_after_minify’,‘
   prefix_remove_type_attr’, 10 ); // ‘Autoptimize’ plugin support
 * }
 * Can you please take a look at this and give me a workaround? I have already updated
   the plugin to the latest version but that didn’t solve the issue.
 * Thanks.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ftype-attribute-causing-accessibility-error%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

The topic ‘Type attribute causing accessibility error’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [kronikon](https://wordpress.org/support/users/kronikon/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/type-attribute-causing-accessibility-error/)
 * Status: not resolved