Custom Taxonomy not showing in Post Gutenberg editor
If someone still having an issue displaying taxonomy or Gutenberg editor, add 'show_in_rest' => true,
in both custom post types as well as taxonomy arguments.
Since Gutenberg is working based on REST API you need to turn on support for REST API for any custom post type and taxonomy. You need to add additional key show_in_rest = true
to your $args
array. Your full code should look like this:
$args = array( 'labels' => $labels, 'public' => true, 'show_in_rest' => true, // add support for Gutenberg editor 'publicly_queryable' => true, 'show_in_nav_menus' => true, 'show_in_rest' => true, 'show_ui' => true, 'show_tagcloud' => true, 'hierarchical' => true, 'rewrite' => true, 'query_var' => true);
It seems that after much investigation, the issue was not with the code above (which is correct). The issue was with a second custom taxonomy, named 'type'. As it turns out, Wordpress contains a number of 'reserved terms', of which one is 'type'. Once this taxonomy was renamed, both taxonomies work correctly, including with Gutenberg.