Taxonomy won’t save on custom post

I’m using WordPress 5.2.2.
I have custom post type (questions), and I’ve registered a new taxonomy called question-categories.
When I go to edit a question, I am not able to see the ‘Categories’ on the right menu. If I click on quick edit, I am able to see categories, and if I start typing, I do see correct suggestions, but they won’t stay after I click on ‘Update’.
I have read this question
Categories won’t appear on custom post type
I did have a plugin Advanced Custom Fields, but I’ve removed it, and now I don’t have any other plugins installed.
Also, everything works on default post types (posts).
I’ve read somewhere that it could be due to custom rest route, but I’ve also tried to remove everything from there, leaving it blank, and it still didn’t work.
This is the code for the custom post type and taxonomy:

register_post_type( ‘question’, array(
‘taxonomies’ => array( ‘category’ ),
‘map_meta_cap’ => true,
‘show_in_rest’ => true,
‘has_archive’ => true,
‘supports’ => array( ‘title’, ‘editor’, ‘comments’, ‘custom-fields’ ),
‘public’ => true,
‘show_ui’ => true,
‘labels’ => array(
‘name’ => ‘Questions’,
‘add_new_item’ => ‘Add new question’,
‘edit_item’ => ‘Edit question’,
‘all_items’ => ‘All questions’,
‘singular_name’ => ‘Question’,
‘menu_icon’ => ‘dashicons-format-status’,
) );

register_taxonomy(‘question-categories’, array(‘question’), array(
‘hierarchical’ => false,
‘labels’ => array(
‘name’ => ‘Categories’,
‘singular_name’ => ‘Category’,
‘search_items’ => ‘Search categories’,
‘all_items’ => ‘All Categories’,
‘parent_item’ => ‘Parent Category’ ,
‘parent_item_colon’ => ‘Parent Category:’,
‘edit_item’ => ‘Edit Category’,
‘update_item’ => ‘Update Category’,
‘add_new_item’ => ‘Add New Category’,
‘new_item_name’ => ‘New Category Name’,
‘menu_name’ => ‘Categories’,
‘meta_box_cb’ => ‘post_categories_meta_box’,
‘exclude_from_search’ => false,
‘show_ui’ => true,
‘show_admin_column’ => true,
‘query_var’ => true,
‘rewrite’ => array( ‘slug’ => ‘category’ ),

Where should I start looking for a problem, and what should I do next? Any help is welcome. Thanks in advance.

Read more here:: Taxonomy won’t save on custom post

Leave a Reply

Your email address will not be published. Required fields are marked *