add_filter( 'clean_url', function( $url )
{
if ( FALSE === strpos( $url, '.js' ) )
{
return $url;
}
return "$url' async='async";
}, 11, 1 );
How to add ASYNC to all the enqueue scripts in WordPress
July 11th, 2016 by Marcos Nobre
Simple add this filter to your theme functions.php file.