• Resolved wpspamnot

    (@wpspamnot)


    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?

    • This topic was modified 5 years, 2 months ago by wpspamnot.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    I can replicate the problem with my own taxonomy, so at least it’s not just you. ATM I’m not sure what the root problem is. In the interim you can edit post taxonomy terms through the quick edit UI. Of course you cannot add terms there, but there is the admin menu for that. While not a solution, at least there is a functional work around besides using the classic editor.

    You might consider filing a new issue over at the Gutenberg GitHub.
    https://github.com/WordPress/gutenberg/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen

    Thread Starter wpspamnot

    (@wpspamnot)

    Thank you so much for checking this and confirming that I’m not alone in this, I’ve been struggling for far too long trying to figure out where did I go wrong!

    I will file the issue with the Gutenberg team and see if they can come up with a solution for this soon-ish. I’m not relying on custom taxonomies at all and I’m happy with changing to the classic editor for it, but it’d be way more convenient the other way.

    Thanks again for your help, cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom taxonimies, gutenberg editor, unable to select/add/delete’ is closed to new replies.