From 48dd13b65728b6c4796574dcb45b9696998508cd Mon Sep 17 00:00:00 2001 From: audrasjb Date: Tue, 8 Jul 2025 08:54:23 +0000 Subject: [PATCH] Editor: Add cache-busting for block styles on development mode. This changeset introduces a development mode for block editor styles. When SCRIPT_DEBUG is enabled, block editor styles now use the file modification time as their version, ensuring cache busting during development. This matches the behavior that already exists for block scripts. Previously, block editor styles only used the version from block.json, which doesn't change during development, causing styles to be cached even after changes. Merges [60355] to the 6.8 branch. Props helgatheviking, abcd95, gziolo, whaze, audrasjb, sandeepdahiya, rollybueno. Fixes #63254. Built from https://develop.svn.wordpress.org/branches/6.8@60434 git-svn-id: http://core.svn.wordpress.org/branches/6.8@59770 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 5 +++-- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index 838cd84a19..8472c7e092 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -328,8 +328,9 @@ function register_block_style_handle( $metadata, $field_name, $index = 0 ) { $style_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $style_path ) ); $style_uri = get_block_asset_url( $style_path_norm ); - $version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false; - $result = wp_register_style( + $block_version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false; + $version = $style_path_norm && defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? filemtime( $style_path_norm ) : $block_version; + $result = wp_register_style( $style_handle_name, $style_uri, array(), diff --git a/wp-includes/version.php b/wp-includes/version.php index e2932aa5d2..3130973e27 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8.2-alpha-60433'; +$wp_version = '6.8.2-alpha-60434'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.