Editor: Fix loading of assets in blocks in child themes where the directory name starts with the parent theme's directory name.

Props lgladdy, masteradhoc, audrasjb, rajinsharwar, azaozz.
Merges [56527] to the 6.3 branch.
Fixes #59018.




Built from https://develop.svn.wordpress.org/branches/6.3@56776


git-svn-id: http://core.svn.wordpress.org/branches/6.3@56288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-10-04 18:47:26 +00:00
parent 5b7940ecfd
commit 8d3525d461
2 changed files with 5 additions and 5 deletions

View File

@ -150,8 +150,8 @@ function register_block_script_handle( $metadata, $field_name, $index = 0 ) {
* Determine if the block script was registered in a theme, by checking if the script path starts with either
* the parent (template) or child (stylesheet) directory path.
*/
$is_parent_theme_block = str_starts_with( $script_path_norm, $template_path_norm );
$is_child_theme_block = str_starts_with( $script_path_norm, $stylesheet_path_norm );
$is_parent_theme_block = str_starts_with( $script_path_norm, trailingslashit( $template_path_norm ) );
$is_child_theme_block = str_starts_with( $script_path_norm, trailingslashit( $stylesheet_path_norm ) );
$is_theme_block = ( $is_parent_theme_block || $is_child_theme_block );
$script_uri = plugins_url( $script_path, $metadata['file'] );
@ -261,8 +261,8 @@ function register_block_style_handle( $metadata, $field_name, $index = 0 ) {
// Determine if the block style was registered in a theme, by checking if the script path starts with either
// the parent (template) or child (stylesheet) directory path.
$is_parent_theme_block = str_starts_with( $style_path_norm, $template_path_norm );
$is_child_theme_block = str_starts_with( $style_path_norm, $stylesheet_path_norm );
$is_parent_theme_block = str_starts_with( $style_path_norm, trailingslashit( $template_path_norm ) );
$is_child_theme_block = str_starts_with( $style_path_norm, trailingslashit( $stylesheet_path_norm ) );
$is_theme_block = ( $is_parent_theme_block || $is_child_theme_block );
if ( $is_core_block ) {

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3.2-alpha-56758';
$wp_version = '6.3.2-alpha-56776';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.