From 9a9352da00df986453e64a5f6198f6dc62df95cd Mon Sep 17 00:00:00 2001 From: gziolo Date: Wed, 1 Jul 2020 13:10:02 +0000 Subject: [PATCH] Editor: Support filtering arguments in block type registration Adds possibility to filter the settings of a block type during its registration. Props aduth, azaozz. Fixes #49615. Built from https://develop.svn.wordpress.org/trunk@48263 git-svn-id: http://core.svn.wordpress.org/trunk@48032 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-block-type.php | 11 +++++++++++ wp-includes/version.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-block-type.php b/wp-includes/class-wp-block-type.php index 4758e172ba..3052affdc1 100644 --- a/wp-includes/class-wp-block-type.php +++ b/wp-includes/class-wp-block-type.php @@ -262,6 +262,17 @@ class WP_Block_Type { $args['name'] = $this->name; + /** + * Filters the arguments for registering a block type. + * + * @since 5.5.0 + * + * @param array $args Array of arguments for registering a + * block type. + * @param string $block_type Block type name including namespace. + */ + $args = apply_filters( 'register_block_type_args', $args, $this->name ); + foreach ( $args as $property_name => $property_value ) { $this->$property_name = $property_value; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 719f199baa..0e71cce8df 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-48262'; +$wp_version = '5.5-alpha-48263'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.