Custom taxonimies, gutenberg editor, unable to select/add/delete
-
Hello everyone,
I’ve been trying to setup a custom hierarchical taxonomy however when I’m editing my post using Gutenberg editor, on the right side menu the child taxonomies don’t appear and I also cannot add any new ones from there. Note that the custom slug that I selected does show up, it’s just not functional.
The obvious workaround is to add new taxonomies directly from the admin menu, but then again the problem remains since they won’t show up at all when editing the blog post. Do note, if I disable Gutenberg and use the classic editor, the taxonomies work exactly as expected.
I’ve read a few posts already about how displaying the custom taxonomies is an issue, but I’ve already handled that. My issue is specifically about selecting/adding/deleting new child taxonomies while working on a post.
Also note, this applies to default post and pages, as well as custom post types (which I’ve made sure to specifically target this taxonomy both at the register_taxonomy() and/or at the register_post_type() functions).
One last thing,
"hierarchical" => false
seems to work in the sense that I’m able to add new tags. However these are not saved; when I save, leave and reopen that blog post in the admin dashboard the tags are all gone.This is the code I wrote:
function my_custom_taxonomies(){ $labels = array( 'name' => 'Sections', 'singular_name' => 'Section', 'search_items' => 'All Sections', 'all_items' => 'All Sections', 'parent_item' => 'Parent Section', 'parent_item_colon' => 'Parent Section:', 'edit_item' => 'Edit Section', 'update_item' => 'Update Section', 'add_new_item' => 'Add New Section', 'new_item_name' => 'New Section Name', 'menu_name' => 'Sections' ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_rest' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array('slug' => 'section') ); register_taxonomy('sections', array('post', 'page'), $args); } add_action('init', 'my_custom_taxonomies');
Thank you all in advance for your help, I feel quite lost here since there doesnt seem to be any issues about this?
- The topic ‘Custom taxonimies, gutenberg editor, unable to select/add/delete’ is closed to new replies.