Skip to content

Commit

Permalink
Merge pull request #20744 from Yoast/support-script-strategy
Browse files Browse the repository at this point in the history
Support script strategy
  • Loading branch information
vraja-pro authored Oct 10, 2023
2 parents d332c1b + 97aaf3b commit fa4b248
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/integrations/third-party/wordproof.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,19 @@ public function register_hooks() {
*/
\add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_assets' ], 10, 0 );

/**
* Add async to the wordproof scripts.
*/
\add_filter( 'script_loader_tag', [ $this, 'add_async_to_script' ], 10, 3 );
if ( version_compare( strtok( get_bloginfo( 'version' ), '-' ), '6.3', '>=' ) ) {
\add_action(
'wp_enqueue_scripts',
function() {
\wp_script_add_data( WPSEO_Admin_Asset_Manager::PREFIX . 'wordproof-uikit', 'strategy', 'async' );
},
11,
0
);
}
else {
\add_filter( 'script_loader_tag', [ $this, 'add_async_to_script' ], 10, 3 );
}

/**
* Removes the post meta timestamp key for the old privacy page.
Expand Down

0 comments on commit fa4b248

Please sign in to comment.