admin管理员组

文章数量:1384952

Gutenberg does not show our custom taxonomies in the editor sidebar. They have always been there using the classic editor. I have addressed the usual suspects (see below) but had no luck. Here is what I've tried:

  • added "show_in_rest" => true to the $args
  • added "public" => true to the $args
  • switched off all plugins (to ensure it is not caused by any of them)
  • switched back to the old editor via "classic editor" plugin (then they appear again immediately)
  • ensured I don't use a reserved word

Here is the code I use to generate the taxonomy - if you have any advice, I would be more than happy to hear your thoughts.

thanks

Jan

$labels = array(
    'name' => _x('Jahreszeiten', 'taxonomy general name', 'mysite'),
    'singular_name' => _x('Jahreszeit', 'taxonomy singular name', 'mysite'),
    'search_items' => __('Jahreszeiten durchsuchen', 'mysite'),
    'all_items' => __('Alle Jahreszeiten', 'mysite'),
    'parent_item' => __('Übergeordnete Jahreszeit', 'mysite'),
    'parent_item_colon' => __('Übergeordnete Jahreszeit:', 'mysite'),
    'edit_item' => __('Jahreszeit bearbeiten', 'mysite'),
    'update_item' => __('Jahreszeit aktualisieren', 'mysite'),
    'add_new_item' => __('Neue Jahreszeit hinzufügen', 'mysite'),
    'new_item_name' => __('Neue Jahreszeit', 'mysite'),
    'menu_name' => __('Jahreszeit', 'mysite'),
);

$rewrite = array(
    'with_front' => false,
    'hierarchical' => true,
    'slug' => __('jahreszeit', 'mysite'),
);

$args = array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_in_rest'      => true,
    'show_admin_column' => true,
    'query_var' => true,
    'rewrite' => $rewrite,
);

register_taxonomy('jahreszeit', array('post', 'pages'), $args);

Gutenberg does not show our custom taxonomies in the editor sidebar. They have always been there using the classic editor. I have addressed the usual suspects (see below) but had no luck. Here is what I've tried:

  • added "show_in_rest" => true to the $args
  • added "public" => true to the $args
  • switched off all plugins (to ensure it is not caused by any of them)
  • switched back to the old editor via "classic editor" plugin (then they appear again immediately)
  • ensured I don't use a reserved word

Here is the code I use to generate the taxonomy - if you have any advice, I would be more than happy to hear your thoughts.

thanks

Jan

$labels = array(
    'name' => _x('Jahreszeiten', 'taxonomy general name', 'mysite'),
    'singular_name' => _x('Jahreszeit', 'taxonomy singular name', 'mysite'),
    'search_items' => __('Jahreszeiten durchsuchen', 'mysite'),
    'all_items' => __('Alle Jahreszeiten', 'mysite'),
    'parent_item' => __('Übergeordnete Jahreszeit', 'mysite'),
    'parent_item_colon' => __('Übergeordnete Jahreszeit:', 'mysite'),
    'edit_item' => __('Jahreszeit bearbeiten', 'mysite'),
    'update_item' => __('Jahreszeit aktualisieren', 'mysite'),
    'add_new_item' => __('Neue Jahreszeit hinzufügen', 'mysite'),
    'new_item_name' => __('Neue Jahreszeit', 'mysite'),
    'menu_name' => __('Jahreszeit', 'mysite'),
);

$rewrite = array(
    'with_front' => false,
    'hierarchical' => true,
    'slug' => __('jahreszeit', 'mysite'),
);

$args = array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_in_rest'      => true,
    'show_admin_column' => true,
    'query_var' => true,
    'rewrite' => $rewrite,
);

register_taxonomy('jahreszeit', array('post', 'pages'), $args);
Share Improve this question asked Jun 5, 2019 at 11:31 JanJan 216 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

You can try 'show_in_rest' => true as an argument in custom post types along with taxonomy registration.

本文标签: block editorcustom taxonomy not showing in Gutenberg