This is an element of the GTMetrix recommendations that has always been difficult to fix but I found a solution that can help it slightly.
Add this code to the functions.php file (on the next line after the <?php at the top).
function defer_parsing_of_js ( $url ) {
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) ) return $url;
return "$url' defer ";
}
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
GTMetrix - Defer parsing of Javascript Print
Modified on: Mon, 9 Apr, 2018 at 10:55 PM
Did you find it helpful? Yes No
Send feedbackSorry we couldn't be helpful. Help us improve this article with your feedback.