Created
September 29, 2017 16:04
-
-
Save ahmethakanbesel/2fa6a059d6cf1d3bd8f9ac9fc8f8dbe4 to your computer and use it in GitHub Desktop.
Wordpress Defer Javascript
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 Javascript | |
*/ | |
add_filter( 'clean_url', function( $url ) | |
{ | |
if ( FALSE === strpos( $url, '.js' ) ) | |
{ | |
return $url; | |
} | |
return "$url' defer='defer"; | |
}, 11, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment