Error when create new category on custom post types
-
Congrats for that helpful plugin.
It works well when you create category into a single post but not in custom post types.
On console I get this error
Uncaught (in promise) TypeError: t.props.speak is not a function
onradio-buttons-for-taxonomies/js/dist/index.js
Thanks
- This topic was modified 3 years, 12 months ago by Nick Papazetis. Reason: Change title
-
Hi Nick,
Can you confirm that this still occurs with a default theme and only this plugin running? Do you have the latest version?
cheers,
-kathyHi Kathy,
I am using a custom made theme and some plugins. I ll try it on default theme and only that as a plugin and i ll come back to you
Thanks,
NickThanks! I may have found the issue, but I’m stuck on the WordPress build scripts that are needed to compile the React script. I really loathe React and the need for build scripts.
In theory, 2.2.2 is on it’s way. Please let me know if that resolves your issue.
Hello.
I updated the plugin and it still doesn’t work.
I have deactivated all plugins as well.Maybe is an isuue on my end. I ll have a look again and let you know.
Thanks.
I just checked the plugin on default theme and only cpt ui plugin.
To reproduce the issue:
1) Create a custom post type and custom taxonomy for that cpt.
2) Select the above taxonomy to convert to radio buttons
3) Create a new post on that cpt (make sure Gutenberg is on)
4) Add new term for that taxonomy inside the new post
5) Have a look on consoleHope that helps.
Hi Nick,
I tested the new version on a new site and can’t reproduce. 2.2.2 explicitly adds the
withSpokenMessages
component that was missing and which I think was responsible for your error.Here’s the code I used to create a book CPT and custom taxonomy “genre”.
/** * Register a custom post type called "book". * * @see get_post_type_labels() for label keys. */ function kia_codex_book_init() { $args = array( 'public' => true, 'label' => __( 'Books', 'textdomain' ), 'supports' => array( 'title', 'editor', 'author', 'thumbnail' ), 'show_in_rest' => true ); register_post_type( 'book', $args ); } add_action( 'init', 'kia_codex_book_init' ); /** * Book Taxonomies */ function kia_create_book_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' => _x( 'Genres', 'taxonomy general name', 'textdomain' ), 'singular_name' => _x( 'Genre', 'taxonomy singular name', 'textdomain' ), 'search_items' => __( 'Search Genres', 'textdomain' ), 'all_items' => __( 'All Genres', 'textdomain' ), 'parent_item' => __( 'Parent Genre', 'textdomain' ), 'parent_item_colon' => __( 'Parent Genre:', 'textdomain' ), 'edit_item' => __( 'Edit Genre', 'textdomain' ), 'update_item' => __( 'Update Genre', 'textdomain' ), 'add_new_item' => __( 'Add New Genre', 'textdomain' ), 'new_item_name' => __( 'New Genre Name', 'textdomain' ), 'menu_name' => __( 'Genre', 'textdomain' ), ); $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_in_rest' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'genre' ), 'default_term' => array( 'name' => 'My default genre', 'slug' => 'default-genre' ), ); register_taxonomy( 'genre', array( 'book' ), $args ); } add_action( 'init', 'kia_create_book_taxonomies' );
Could you make sure to flush any caches? to ensure that you have the latest version of
js/dist.js
?Hello,
My bad.
It’s a tag taxonomy.
hierarchical => false
On categories it’s working fine
I can convert it to category but is there any chance you can fix it for tags as well?
Thanks
- This reply was modified 3 years, 11 months ago by Nick Papazetis.
Thanks for narrowing that down. I will check on it when I have some availability.
Hi Nick,
I think I found the issue. React/Gutenberg is still quite new to me, so who knows. 🙂
Could you test out my fix? It is available here:
https://github.com/helgatheviking/Radio-Buttons-for-Taxonomies/tree/issues/88-tagsLet me know if that works out for you and I will try to package it up and release it.
cheers,
-kathyHello,
You are awesome.
That worked on both tags and categories.Thank you for sorting this out.
Awesome! Glad that’s working. I will ship out the new version.
Could I talk you into leaving a review?
https://wordpress.org/support/plugin/radio-buttons-for-taxonomies/reviews/#new-post
- The topic ‘Error when create new category on custom post types’ is closed to new replies.