Skip to content

Commit

Permalink
Replace WP modules action with GB modules
Browse files Browse the repository at this point in the history
Avoid registering modules twice.

Anticipates changes in WordPress/wordpress-develop#7360
  • Loading branch information
sirreal committed Sep 19, 2024
1 parent 6186713 commit ee5535f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ function gutenberg_register_vendor_scripts( $scripts ) {
*
* Script modules that are registered by Core will be re-registered by Gutenberg.
*/
function gutenberg_register_script_modules() {
function gutenberg_default_script_modules() {
/*
* Expects multidimensional array like:
*
Expand Down Expand Up @@ -645,11 +645,11 @@ function gutenberg_register_script_modules() {
}

$path = gutenberg_url( "build-module/{$file_name}" );
wp_deregister_script_module( $script_module_id );
wp_register_script_module( $script_module_id, $path, $script_module_data['dependencies'], $script_module_data['version'] );
}
}
add_action( 'after_setup_theme', 'gutenberg_register_script_modules', 20 );
remove_action( 'wp_default_scripts', 'wp_default_script_modules' );
add_action( 'wp_default_scripts', 'gutenberg_register_script_modules' );

/*
* Always remove the Core action hook while gutenberg_enqueue_stored_styles() exists to avoid styles being printed twice.
Expand Down

0 comments on commit ee5535f

Please sign in to comment.