Tagged: valid, validation, w3c, warning
- This topic has 2 replies, 2 voices, and was last updated 5 years, 11 months ago by Trevor.
-
Anonymous(Private) January 17, 2019 at 11:11 am #199196
Hi there
If I run my site through the W3C validation checker, it is almost perfect except for a few warnings generated because of mods, and yours is one if them. They are really simple to fix, so I would appreciate it if you could do this in your next up date.
Basically every time you use the script tag, for example:
<script type=’text/javascript’ src=’https://www.strmr.co.za/wp-content/plugins/search-filter-pro/public/assets/js/search-filter-build.min.js?ver=2.4.6′></script>You need to leave of the type attribute, so it would be this instead:
<script src=’https://www.strmr.co.za/wp-content/plugins/search-filter-pro/public/assets/js/search-filter-build.min.js?ver=2.4.6′></script>There are a few places the script tag is used where the type attribute needs to be removed.
Trevor(Private) January 17, 2019 at 12:27 pm #199203I have a feeling this is WordPress doing this, as we simply enqueue the files (but I could be wrong). This post might help you:
https://www.lee-harris.co.uk/blog/remove-type-attribute-script-tags-wordpress/
Trevor(Private) January 17, 2019 at 12:29 pm #199205As a follow up, this is the code that would need to go in to your child theme’s functions.php file:
add_action( 'template_redirect', function(){ ob_start( function( $buffer ){ $buffer = str_replace( array( 'type="text/javascript"', "type='text/javascript'" ), '', $buffer ); return $buffer; }); });
You could use this in other ways:
$buffer = str_replace( array( 'type="text/css"', "type='text/css'" ), '', $buffer ); $buffer = str_replace( array( 'frameborder="0"', "frameborder='0'" ), '', $buffer ); $buffer = str_replace( array( 'scrolling="no"', "scrolling='no'" ), '', $buffer );
-
AuthorPosts