wp_script_modules()WP 6.5.0

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.

No Hooks.

Return

WP_Script_Modules. The main WP_Script_Modules instance.

Usage

wp_script_modules(): WP_Script_Modules;

Notes

  • Global. WP_Script_Modules. $wp_script_modules

Changelog

Since 6.5.0 Introduced.

wp_script_modules() code WP 6.5.4

function wp_script_modules(): WP_Script_Modules {
	global $wp_script_modules;

	if ( ! ( $wp_script_modules instanceof WP_Script_Modules ) ) {
		$wp_script_modules = new WP_Script_Modules();
	}

	return $wp_script_modules;
}