Support Forums

Support Forums Forums General Support Validation Warnings

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Trevor 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Roxane Lapa
    #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 Moderator
    #199203

    I 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 Moderator
    #199205

    As 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 );
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.