最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

block editor - Custom taxonomy is crashing Gutenberg

programmeradmin1浏览0评论

I have a custom taxonomy, "Type" and I have it registered to my custom post type "Resource." But if I enable "show_in_rest" I get a JS error:

TypeError: Cannot read property 'transientEdits' of undefined

and Gutenberg doesn't load up.

Here's my tax:

    $args = array(
        'labels'                     => $labels, 
        'hierarchical'               => false,
        'public'                     => true,
        'show_ui'                    => true,
        'show_admin_column'          => true,
        'show_in_nav_menus'          => true,
        'show_tagcloud'              => true,
        'show_in_rest'               => true,
    );
    register_taxonomy( 'type', array( 'resource' ), $args );

Thanks in advance for any advice.

I have a custom taxonomy, "Type" and I have it registered to my custom post type "Resource." But if I enable "show_in_rest" I get a JS error:

TypeError: Cannot read property 'transientEdits' of undefined

and Gutenberg doesn't load up.

Here's my tax:

    $args = array(
        'labels'                     => $labels, 
        'hierarchical'               => false,
        'public'                     => true,
        'show_ui'                    => true,
        'show_admin_column'          => true,
        'show_in_nav_menus'          => true,
        'show_tagcloud'              => true,
        'show_in_rest'               => true,
    );
    register_taxonomy( 'type', array( 'resource' ), $args );

Thanks in advance for any advice.

Share Improve this question asked Sep 18, 2019 at 17:42 ColinColin 1212 gold badges3 silver badges8 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Changing the taxonomy name fixes. I'll wager the guess that having it called 'type' was conflicting with the Gutenberg js.

    $args = array(
        'labels'                     => $labels,
        'hierarchical'               => false,
        'public'                     => true,
        'show_ui'                    => true,
        'show_admin_column'          => true,
        'show_in_nav_menus'          => true,
        'show_tagcloud'              => false,
        'show_in_rest'               => true,
    );
    register_taxonomy( 'resource-type', array( 'resource' ), $args );
发布评论

评论列表(0)

  1. 暂无评论