Add custom tags support to Gutenberg editor
-
Hello,
I have been trying to add tags support to custom post type.
I have enabled Gutenberg support for custom post and tried to enable post_tag in$args
configuration:$args = array( //... 'show_in_rest' => true, 'taxonomies' => array( 'category', 'post_tag' ), //... ); register_post_type( 'myslug', $args );
I have tried registering custom
myslug_tag
:$args = array( //... 'show_in_rest' => true, 'taxonomies' => array( 'category', 'myslug_tag' ), //... ); register_post_type( 'myslug', $args ); register_taxonomy( 'myslug_tag', 'myslug', array( 'label' => __( 'Tags', 'text_domain_myslug' ), 'singular_name' => __( 'Tag', 'text_domain_myslug' ), 'hierarchical' => false, 'rewrite' => true, 'query_var' => true ) );
But that does not work either.
The second approach gives me the “Tags” link in custom post type menu in admin sidebar, but when I try to edit the post, tags are not there.The tags work when I use the classic editor, I can select or add new tags, but when I switch back to Gutenberg, tags disappear.
Am I doing something wrong here or did custom tags changed so much with Gutenberg editor?
Thank you
Filip[update]
All code runs in theinit
hook:add_action('wp_init', array( $this, 'register_types' ) );
Where
register_types
is public function that:- 1. Calls
register_post_type()
- 2. Calls
register_taxonomy()
The page I need help with: [log in to see the link]
- 1. Calls
- The topic ‘Add custom tags support to Gutenberg editor’ is closed to new replies.