Skip to content

Commit

Permalink
Add class exist check before removing hooks added by Gutenberg plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
thelovekesh committed Dec 18, 2023
1 parent 04d1298 commit 4248179
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions includes/class-amp-theme-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -906,13 +906,16 @@ static function() {
0
);

// Prevent Interactivity API from being enqueued in the form of modules.
// Prevent Interactivity API scripts from being enqueued.
// TODO: This will need to be updated once Interactivity API is merged from Gutenberg into core.
remove_action( 'wp_enqueue_scripts', 'gutenberg_register_interactivity_module' );
remove_action( 'wp_head', [ 'Gutenberg_Modules', 'print_import_map' ] );
remove_action( 'wp_head', [ 'Gutenberg_Modules', 'print_enqueued_modules' ] );
remove_action( 'wp_head', [ 'Gutenberg_Modules', 'print_module_preloads' ] );
remove_action( 'wp_footer', [ 'Gutenberg_Modules', 'print_import_map_polyfill' ], 11 );

if ( class_exists( 'Gutenberg_Modules' ) ) {
remove_action( 'wp_head', [ 'Gutenberg_Modules', 'print_import_map' ] );
remove_action( 'wp_head', [ 'Gutenberg_Modules', 'print_enqueued_modules' ] );
remove_action( 'wp_head', [ 'Gutenberg_Modules', 'print_module_preloads' ] );
remove_action( 'wp_footer', [ 'Gutenberg_Modules', 'print_import_map_polyfill' ], 11 );
}
}

/**
Expand Down

0 comments on commit 4248179

Please sign in to comment.