I know this has been asked before, I have searched all over the internet and encountered several people with similar problem and some of them with solutions (none of those solutions worked for me, obviously). Here's how I'm registering my custom taxonomy (labels not included for simplicity):
register_taxonomy( 'location', array( 'restaurant' ), array(
'labels' => $labels,
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'query_var' => true,
'show_in_nav_menus' => true,
'show_admin_column' => true,
'show_in_rest' => true, // Needed for tax to appear in Gutenberg editor.
'rewrite' => array( 'slug' => 'location' ),
));
I don't know if it is related, but here is how I'm registering the Custom Type Post (again, labels not included for simplicity):
$args = array(
'labels' => $labels,
'description' => __( 'Descripción.', 'text-domain' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'restaurant' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'taxonomies' => array('location'),
'menu-icon' => 'dashicons-format-gallery',
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type( 'restaurant', $args );
Result in Gutenberg:
Wraping up: I can use the taxonomies normally outside of Gutenberg and I can see the tab in the document panel in Gutenberg, but taxonomies are not showing up there and also the Add new location button inside Gutenberg does not work
Thanks for your help
I know this has been asked before, I have searched all over the internet and encountered several people with similar problem and some of them with solutions (none of those solutions worked for me, obviously). Here's how I'm registering my custom taxonomy (labels not included for simplicity):
register_taxonomy( 'location', array( 'restaurant' ), array(
'labels' => $labels,
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'query_var' => true,
'show_in_nav_menus' => true,
'show_admin_column' => true,
'show_in_rest' => true, // Needed for tax to appear in Gutenberg editor.
'rewrite' => array( 'slug' => 'location' ),
));
I don't know if it is related, but here is how I'm registering the Custom Type Post (again, labels not included for simplicity):
$args = array(
'labels' => $labels,
'description' => __( 'Descripción.', 'text-domain' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'restaurant' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'taxonomies' => array('location'),
'menu-icon' => 'dashicons-format-gallery',
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type( 'restaurant', $args );
Result in Gutenberg:
Wraping up: I can use the taxonomies normally outside of Gutenberg and I can see the tab in the document panel in Gutenberg, but taxonomies are not showing up there and also the Add new location button inside Gutenberg does not work
Thanks for your help
Share Improve this question asked Oct 6, 2019 at 23:20 SophtSopht 134 bronze badges1 Answer
Reset to default 1I found the problem. I was registering a custom post type with the same name 'location' as the taxonomy. Renaming one of the two did the job for me.