Support » Plugin: Radio Buttons for Taxonomies » Error when create new category on custom post types

  • Resolved Nick Papazetis

    (@papazetis)


    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
    on radio-buttons-for-taxonomies/js/dist/index.js

    Thanks

    • This topic was modified 2 months, 3 weeks ago by Nick Papazetis. Reason: Change title
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author HelgaTheViking

    (@helgatheviking)

    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,
    -kathy

    Thread Starter Nick Papazetis

    (@papazetis)

    Hi 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,
    Nick

    Plugin Author HelgaTheViking

    (@helgatheviking)

    Thanks! 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.

    Plugin Author HelgaTheViking

    (@helgatheviking)

    In theory, 2.2.2 is on it’s way. Please let me know if that resolves your issue.

    Thread Starter Nick Papazetis

    (@papazetis)

    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.

    Thread Starter Nick Papazetis

    (@papazetis)

    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 console

    Hope that helps.

    Plugin Author HelgaTheViking

    (@helgatheviking)

    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?

    Thread Starter Nick Papazetis

    (@papazetis)

    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

    Plugin Author HelgaTheViking

    (@helgatheviking)

    Thanks for narrowing that down. I will check on it when I have some availability.

    Plugin Author HelgaTheViking

    (@helgatheviking)

    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-tags

    Let me know if that works out for you and I will try to package it up and release it.

    cheers,
    -kathy

    Thread Starter Nick Papazetis

    (@papazetis)

    Hello,

    You are awesome.
    That worked on both tags and categories.

    Thank you for sorting this out.

    Plugin Author HelgaTheViking

    (@helgatheviking)

    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

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.