Defer JS in WordPress by adding this to the functions.php file. Beware this may screw up your website, so be careful with it, and make a backup of your functions.php file.
1 2 3 4 5 6 7 8 |
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 ); |