Notifications
Clear all
Topic starter 11/08/2021 5:44 am
Remove type attribute from style and script in wordpress.
Add the following piece of script in your themes functions.php file
add_action( 'after_setup_theme', function() { add_theme_support( 'html5', [ 'script', 'style' ] ); } );
Topic starter 11/08/2021 6:01 am
add_action( 'template_redirect', 'remove_type_attr' ); function remove_type_attr() { ob_start( function ( $buffer ) { return preg_replace( "%[ ]type=['\"]text\/(javascript|css)['\"]%", '', $buffer ); } ); }
Topic starter 11/08/2021 6:01 am
add_action( 'template_redirect', 'remove_language_attr' ); function remove_language_attr() { ob_start( function ( $buffer ) { return preg_replace( "%[ ]language=['\"]JavaScript['\"]%", '', $buffer ); } ); }