Script Modules: prevent broken links by using includes_url.

[59083] introduced an issue where Script Modules registered src does not correctly respect the includes path.

Before that change, script modules were registered using includes_url. The patch used a hard-coded path which breaks when sites are not served from the root, e.g. the site root is https://example.com/wp instead of https://example.com/.

Follow-up to [59083].

Props nendeb55, jonsurrell, cbravobernal.

Fixes #62146.


Built from https://develop.svn.wordpress.org/trunk@59154


git-svn-id: http://core.svn.wordpress.org/trunk@58549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
cbravobernal 2024-10-01 17:25:14 +00:00
parent 9b1e0766f7
commit 18f992af83
2 changed files with 2 additions and 2 deletions

View File

@ -169,7 +169,7 @@ function wp_default_script_modules() {
break;
}
$path = "/wp-includes/js/dist/script-modules/{$file_name}";
$path = includes_url( "js/dist/script-modules/{$file_name}" );
wp_register_script_module( $script_module_id, $path, $script_module_data['dependencies'], $script_module_data['version'] );
}
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-beta1-59153';
$wp_version = '6.7-beta1-59154';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.