Since Gutenberg 13.3 (and WP 6.1), a post term block variation is generated for each custom taxonomy registered. For example, if you register a “Product category” taxonomy, you should able to add a “Product categories” block that lists all the product category terms assigned to the current post.
I'm working on a plugin that registers a couple of custom taxonomies for a custom post type:
function register_post_types() {
// Register custom post type (omitted for brevity)
(...)
// Register custom taxonomies
$cat_labels = array(
'name' => __( 'Exhibit Categories' ),
'singular_name' => __( 'Category' ),
'add_new_item' => __( 'Add New Category' ),
'edit_item' => __( 'Edit Category' ),
'new_item_name' => __( 'New Category' ),
'search_items' => __( 'Search Categories' ),
'all_items' => __( 'All Categories' ),
'popular_items' => __( 'Popular Categories' ),
);
$cat_args = array(
'show_ui' => true,
'show_in_rest' => true,
'show_admin_column' => true,
'query_var' => true,
'public' => true,
'publicly_queryable' => true,
'labels' => $cat_labels,
'hierarchical' => true,
);
register_taxonomy( 'exhibit_category', 'exhibit', $cat_args );
$tag_labels = array(
'name' => __( 'Exhibit Tags' ),
'singular_name' => __( 'Tag' ),
'add_new_item' => __( 'Add New Tag' ),
'edit_item' => __( 'Edit Tag' ),
'new_item_name' => __( 'New Tag' ),
'search_items' => __( 'Search Tags' ),
'all_items' => __( 'All Tags' ),
'popular_items' => __( 'Popular Tags' ),
);
$tag_args = array(
'show_ui' => true,
'show_in_rest' => true,
'show_admin_column' => true,
'query_var' => true,
'public' => true,
'publicly_queryable' => true,
'labels' => $tag_labels,
'hierarchical' => false,
);
register_taxonomy( 'exhibit_tag', 'exhibit', $tag_args );
}
add_action( 'init', 'register_post_types' );
Both the custom post type and the custom taxonomy are registered correctly as they appear in the admin side menu, but for some reason when searching for the generated post term block variations using the block inserter they don't show up.
In the following screenshot you can see the issue (Both the "Product tags" and "Product categories" taxonomies come from a WooCommerce install):
Any ideas?