0

I have created a custom post type and custom taxonomy. I need to allow editing a taxonomy page in Gutenberg, but WordPress allows me to use only certain fields. How can I overcome this problem?

function first_post_type()
{

    $args = array(

        'labels' => array(

            'name' => 'Stock',
            'singular_name' => 'Unit',
        ),


        'hierachical' => true, 
        'public' => true,
        'has_archive' => true,
        'menu_icon' => 'dashicons-schedule',
        'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),
        //'rewrite' => array ('slug' => 'products'),
    );

    register_post_type('products', $args);

}
add_action('init', 'first_post_type');



function first_post_taxonomy()
{
    $args = array(
        'labels' => array(
                'name' => 'Categories',
                'singular_name' => 'Category',  
        ),
            'public' => true,
            'hierarchical' => true, 
            'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),
            'show_ui'           => true,
            'show_admin_column' => true,
            'show_in_rest'      => true,
            'query_var'         => true,            
    );

    register_taxonomy('units', array('products'), $args);

}

add_action('init', 'first_post_taxonomy');


1 Answer 1

1

You did not add show in rest argument, set to true in post registration. Everything must be REST-enabled, since REST is the way block editor communicates with the rest :) of WordPress

1
  • Did you try this solution?
    – Lovor
    Commented Dec 29, 2022 at 0:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.