Created
March 12, 2024 03:57
-
-
Save blakewilson/bd90a366c9c46082c6e4bcee9c236a10 to your computer and use it in GitHub Desktop.
Defer Vidbgpro Vimeo player JS
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
<?php | |
function defer_vidbgpro_vimeo() { | |
/** | |
* As of WP 6.3, you can specify an array of args instead of the boolean for in_footer. | |
* These args can provide an optional strategy: blocking, defer, or async. | |
* @link https://make.wordpress.org/core/2023/07/14/registering-scripts-with-async-and-defer-attributes-in-wordpress-6-3/ | |
*/ | |
wp_enqueue_script( | |
'vidbgpro-vimeo', | |
'https://player.vimeo.com/api/player.js', | |
array(), | |
false, | |
array( | |
'strategy' => 'defer' | |
) | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'defer_vidbgpro_vimeo' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment