mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@51262 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user