Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
try different approach
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed May 4, 2023
1 parent 17d551b commit 20cf6ad
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Assets/AssetDataRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,15 @@ public function __construct( Api $asset_api ) {
* Hook into WP asset registration for enqueueing asset data.
*/
protected function init() {
add_action( 'init', array( $this, 'register_data_script' ) );
add_action( 'enqueue_block_assets', array( $this, 'enqueue_asset_data' ), 2 );
// @todo: Remove this check when WordPress 6.3 is the minimum supported version.
if ( is_admin() ) {
add_action( 'enqueue_block_assets', array( $this, 'register_data_script' ) );
} else {
add_action( 'init', array( $this, 'register_data_script' ) );
}

add_action( 'wp_print_footer_scripts', array( $this, 'enqueue_asset_data' ), 2 );
add_action( 'admin_print_footer_scripts', array( $this, 'enqueue_asset_data' ), 2 );
}

/**
Expand Down

0 comments on commit 20cf6ad

Please sign in to comment.