Created
November 13, 2018 10:44
-
-
Save amorkovin/4ecb78fd550ce9d3b44fb0f777ea98ad to your computer and use it in GitHub Desktop.
Async для скриптов WordPress
This file contains hidden or 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
function mihdan_add_async_attribute( $tag, $handle ) { | |
if ( 'my-js-handle' !== $handle ) { | |
return $tag; | |
} | |
return str_replace( ' src', ' async="async" src', $tag ); | |
} | |
add_filter( 'script_loader_tag', 'mihdan_add_async_attribute', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment