Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Async and defer script */
- function my_theme_async_defer_script( $tag , $handle , $src )
- {
- $async = ( $handle == 'my-theme-scripts' ) ? 'async defer src' : 'src';
- return str_replace( "src" , $async , $tag );
- }
- add_action( 'script_loader_tag' , 'my_theme_async_defer_script' , 10 , 4 );
- ?>
Add Comment
Please, Sign In to add comment