[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> script-modules.php (summary)

Script Modules API: Script Module functions

File Size: 239 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 8 functions

  wp_script_modules()
  wp_register_script_module()
  wp_enqueue_script_module()
  wp_dequeue_script_module()
  wp_deregister_script_module()
  wp_set_script_module_translations()
  wp_default_script_modules()
  wp_enqueue_block_editor_script_modules()

Functions
Functions that are not part of a class:

wp_script_modules()   X-Ref
Retrieves the main WP_Script_Modules instance.

This function provides access to the WP_Script_Modules instance, creating one
if it doesn't exist yet.

return: WP_Script_Modules The main WP_Script_Modules instance.

wp_register_script_module( string $id, string $src, array $deps = array()   X-Ref
Registers the script module if no script module with that script module
identifier has already been registered.

param: string                              $id      The identifier of the script module. Should be unique. It will be used in the
param: string                              $src     Optional. Full URL of the script module, or path of the script module relative
param: array<string|array<string, string>> $deps    {
param: string|false|null                   $version Optional. String specifying the script module version number. Defaults to false.
param: array<string, string|bool>          $args    {

wp_enqueue_script_module( string $id, string $src = '', array $deps = array()   X-Ref
Marks the script module to be enqueued in the page.

If a src is provided and the script module has not been registered yet, it
will be registered.

param: string                              $id      The identifier of the script module. Should be unique. It will be used in the
param: string                              $src     Optional. Full URL of the script module, or path of the script module relative
param: array<string|array<string, string>> $deps    {
param: string|false|null                   $version Optional. String specifying the script module version number. Defaults to false.
param: array<string, string|bool>          $args    {

wp_dequeue_script_module( string $id )   X-Ref
Unmarks the script module so it is no longer enqueued in the page.

param: string $id The identifier of the script module.

wp_deregister_script_module( string $id )   X-Ref
Deregisters the script module.

param: string $id The identifier of the script module.

wp_set_script_module_translations( string $id, string $domain = 'default', string $path = '' )   X-Ref
Overrides the text domain and path used to load translations for a script module.

Translations for script modules are loaded automatically from the default
text domain and language directory. Use this function only when a module's
text domain differs from `'default'` or when translation files live outside
the standard location, for example plugin modules using their own text domain.

return: bool True if the text domain was registered, false if the module is not registered.
param: string $id     The identifier of the script module.
param: string $domain Optional. Text domain. Default 'default'.
param: string $path   Optional. The full file path to the directory containing translation files.

wp_default_script_modules()   X-Ref
Registers all the default WordPress Script Modules.


wp_enqueue_block_editor_script_modules()   X-Ref
Enqueues script modules required by the block editor.




Generated : Wed Jul 1 08:20:12 2026 Cross-referenced by PHPXref