mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@57593 git-svn-id: http://core.svn.wordpress.org/trunk@57094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c04996591b
commit
b0e171fe16
@ -151,6 +151,18 @@ class WP_Script_Modules {
|
||||
unset( $this->enqueued_before_registered[ $id ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a registered script module.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param string $id The identifier of the script module.
|
||||
*/
|
||||
public function deregister( string $id ) {
|
||||
unset( $this->registered[ $id ] );
|
||||
unset( $this->enqueued_before_registered[ $id ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the hooks to print the import map, enqueued script modules and script
|
||||
* module preloads.
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.5-alpha-57592';
|
||||
$wp_version = '6.5-alpha-57593';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user