diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php index e911de832a..7c3509daac 100644 --- a/src/wp-includes/blocks.php +++ b/src/wp-includes/blocks.php @@ -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.