Skip to content

Instantly share code, notes, and snippets.

@blakewilson
Created March 12, 2024 03:57
Show Gist options
  • Save blakewilson/bd90a366c9c46082c6e4bcee9c236a10 to your computer and use it in GitHub Desktop.
Save blakewilson/bd90a366c9c46082c6e4bcee9c236a10 to your computer and use it in GitHub Desktop.
Defer Vidbgpro Vimeo player JS
<?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