In short, it’s because your Formats taxonomy is not enabled in the REST API.
Events shows both custom taxonomies and the built-in Categories, Resources only the built-in.
That is actually the expected behavior.
-
The Events post type doesn’t have the
editor
support, i.e.$supports = array('title', 'featured-image', 'thumbnail', 'excerpt');
— noeditor
in the list. -
But the Resources post type has the
editor
support —$supports = array('title', 'editor','featured-image', 'thumbnail', 'excerpt');
, which means the editor will be made available on the post editing screen and the default editor is Gutenberg (the block editor).
Now because Gutenberg uses the WordPress REST API, e.g. when adding/removing/updating a taxonomy term, then the taxonomies associated to a post type must have the show_in_rest
argument set to true
(i.e. enabled in the REST API) in order for the taxonomy selector UI/panel to be available in the Gutenberg sidebar.
So to fix the issue, you would just need to add 'show_in_rest' => true
into your taxonomy arguments:
function rdcfp_register_custom_taxonomy ($name, $singular_name, $hierarchical, $associated_types) {
$labels = ... your code;
$args = array(
'label' => $name,
'labels' => $labels,
'show_ui' => true,
'public' => true,
'hierarchical' => $hierarchical,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => $name ),
'show_in_rest' => true, // add this line
);
register_taxonomy($name, $associated_types, $args);
}
Or you could also add a $show_in_rest
parameter to your rdcfp_register_custom_taxonomy()
function, but I’ll let you write the code for that on your own. 🙂