Boost Up Website PageSpeed with defer parsing of JavaScript


My website is based on WordPress

Page Speed Testing:

Tested using


How to defer parsing of JavaScript … ?


Open your wp-includes/function.php and add this code:

function defer_parsing_of_js( $url ) {
    if ( is_user_logged_in() ) return $url; //don't break WP Admin
    if ( FALSE === strpos( $url, '.js' ) ) return $url;
    if ( strpos( $url, 'jquery.js' ) ) return $url;
    return str_replace( ' src', ' defer src', $url );
add_filter( 'script_loader_tag', 'defer_parsing_of_js', 10 );


Re-test again using and see that the “Defer Parsing of JavaScript” Grade increase or no

Thanks for reading

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *