diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index f79c95428d..c13f2f7592 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -2232,6 +2232,7 @@ function get_block_editor_server_block_settings() { 'styles' => 'styles', 'textdomain' => 'textdomain', 'parent' => 'parent', + 'ancestor' => 'ancestor', 'keywords' => 'keywords', 'example' => 'example', 'variations' => 'variations', diff --git a/wp-includes/class-wp-block-type.php b/wp-includes/class-wp-block-type.php index b3700e8d2e..47e6619fe2 100644 --- a/wp-includes/class-wp-block-type.php +++ b/wp-includes/class-wp-block-type.php @@ -58,6 +58,15 @@ class WP_Block_Type { */ public $parent = null; + /** + * Setting ancestor makes a block available only inside the specified + * block types at any position of the ancestor's block subtree. + * + * @since 6.0.0 + * @var array|null + */ + public $ancestor = null; + /** * Block type icon. * @@ -207,6 +216,7 @@ class WP_Block_Type { * @since 5.6.0 Added the `api_version` property. * @since 5.8.0 Added the `variations` property. * @since 5.9.0 Added the `view_script` property. + * @since 6.0.0 Added the `ancestor` property. * * @see register_block_type() * @@ -221,6 +231,8 @@ class WP_Block_Type { * search interfaces to arrange block types by category. * @type array|null $parent Setting parent lets a block require that it is only * available when nested within the specified blocks. + * @type array|null $ancestor Setting ancestor makes a block available only inside the specified + * block types at any position of the ancestor's block subtree. * @type string|null $icon Block type icon. * @type string $description A detailed block type description. * @type string[] $keywords Additional keywords to produce block type as diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php index c546a3082a..95b12e388a 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php @@ -266,6 +266,7 @@ class WP_REST_Block_Types_Controller extends WP_REST_Controller { 'category', 'keywords', 'parent', + 'ancestor', 'provides_context', 'uses_context', 'supports', @@ -645,6 +646,16 @@ class WP_REST_Block_Types_Controller extends WP_REST_Controller { 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), + 'ancestor' => array( + 'description' => __( 'Ancestor blocks.' ), + 'type' => array( 'array', 'null' ), + 'items' => array( + 'type' => 'string', + ), + 'default' => null, + 'context' => array( 'embed', 'view', 'edit' ), + 'readonly' => true, + ), 'keywords' => $keywords_definition, 'example' => $example_definition, ), diff --git a/wp-includes/version.php b/wp-includes/version.php index e8b3140256..77b88bc9ae 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-53083'; +$wp_version = '6.0-alpha-53084'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.