mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
Editor: Fix broken asset URLs when using WP outside of the regular directory
Both CSS and JS URLs were totally broken for some of the newer blocks (e.g. the navigation block in the 2022 theme) when WP core is outside of the current directory using a different prefix. Props pgpagely, Mamaduka. Fixes #55311. Built from https://develop.svn.wordpress.org/trunk@52939 git-svn-id: http://core.svn.wordpress.org/trunk@52528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
65d06b7cdc
commit
54bdc31c99
@ -107,7 +107,7 @@ function register_block_script_handle( $metadata, $field_name ) {
|
||||
return false;
|
||||
}
|
||||
// Path needs to be normalized to work in Windows env.
|
||||
$wpinc_path_norm = wp_normalize_path( ABSPATH . WPINC );
|
||||
$wpinc_path_norm = wp_normalize_path( realpath( ABSPATH . WPINC ) );
|
||||
$script_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $script_path ) );
|
||||
$is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $wpinc_path_norm );
|
||||
|
||||
@ -149,7 +149,7 @@ function register_block_style_handle( $metadata, $field_name ) {
|
||||
if ( empty( $metadata[ $field_name ] ) ) {
|
||||
return false;
|
||||
}
|
||||
$wpinc_path_norm = wp_normalize_path( ABSPATH . WPINC );
|
||||
$wpinc_path_norm = wp_normalize_path( realpath( ABSPATH . WPINC ) );
|
||||
$is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $wpinc_path_norm );
|
||||
if ( $is_core_block && ! wp_should_load_separate_core_block_assets() ) {
|
||||
return false;
|
||||
@ -243,7 +243,7 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
|
||||
if ( ! is_array( $metadata ) || empty( $metadata['name'] ) ) {
|
||||
return false;
|
||||
}
|
||||
$metadata['file'] = wp_normalize_path( $metadata_file );
|
||||
$metadata['file'] = wp_normalize_path( realpath( $metadata_file ) );
|
||||
|
||||
/**
|
||||
* Filters the metadata provided for registering a block type.
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-alpha-52938';
|
||||
$wp_version = '6.0-alpha-52939';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
x
Reference in New Issue
Block a user