Script Modules API: Add deregister module function

It was impossible to deregister a script module. It is changing to avoid problems for extenders that want to override any Core script module.

Fixes #60463.
Props cbravobernal, gziolo, mukesh27, youknowriad.



git-svn-id: https://develop.svn.wordpress.org/trunk@57593 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Greg Ziółkowski
2024-02-12 12:58:53 +00:00
parent d7c132b829
commit 13a042f8b7
3 changed files with 96 additions and 0 deletions

View File

@@ -112,3 +112,14 @@ function wp_enqueue_script_module( string $id, string $src = '', array $deps = a
function wp_dequeue_script_module( string $id ) {
wp_script_modules()->dequeue( $id );
}
/**
* Deregisters the script module.
*
* @since 6.5.0
*
* @param string $id The identifier of the script module.
*/
function wp_deregister_script_module( string $id ) {
wp_script_modules()->deregister( $id );
}