Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function add_async_attribute( $tag, $handle ) {
if ( 'my-google-adsense-js' !== $handle) {
return $tag;
} else {
return str_replace(' src', ' async="async" src', $tag);
}
}
apply_filters( 'script_loader_tag', 'add_async_attribute' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.