Skip to content

Commit

Permalink
Script Modules: prevent broken links by using includes_url.
Browse files Browse the repository at this point in the history
[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.



git-svn-id: https://develop.svn.wordpress.org/trunk@59154 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
cbravobernal committed Oct 1, 2024
1 parent 98bb941 commit 957b4e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/script-modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] );
}
}

0 comments on commit 957b4e5

Please sign in to comment.