Created
March 25, 2019 08:14
-
-
Save sudipto-me/91585aa72a7b29edb80fc8f31d835c41 to your computer and use it in GitHub Desktop.
To defer javascript files in the website page speed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Defer Parsing of javascript*/ | |
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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment