From 6fc65b33d5f64f3e50718d532b563813c9707450 Mon Sep 17 00:00:00 2001 From: desrosj Date: Tue, 29 Jun 2021 18:24:56 +0000 Subject: [PATCH] Script Loader: Use the provided block version when registering styles. This updates `register_block_style_handle()` to use the `version` value provided in the `$metadata` parameter for non-Core blocks (when present). This removes the requirement to use `filemtime()` to generate a unique version. When `version` is not defined within `$metadata`, the script version will fallback to using the current version of WordPress. The block version should be considered similar to the one specified by plugin developers within the header of the main plugin file. Props hellofromTonya, gziolo, jorbin, desrosj, walbo, aristath. Fixes #53507. Built from https://develop.svn.wordpress.org/trunk@51262 git-svn-id: http://core.svn.wordpress.org/trunk@50871 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index c60ddf18e0..905cb48b37 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -164,7 +164,7 @@ function register_block_style_handle( $metadata, $field_name ) { $block_dir = dirname( $metadata['file'] ); $style_file = realpath( "$block_dir/$style_path" ); $has_style_file = false !== $style_file; - $version = ! $is_core_block && $has_style_file ? filemtime( $style_file ) : false; + $version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false; $style_uri = $has_style_file ? $style_uri : false; $result = wp_register_style( $style_handle, diff --git a/wp-includes/version.php b/wp-includes/version.php index c72b056461..2f39112663 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-beta4-51261'; +$wp_version = '5.8-beta4-51262'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.