問題点
Gutenberg カスタム投稿編集画面にて「カテゴリ」と「タグ」が表示させたい。
「文書」
「ブロック」
functions.php 該当記載内容
<?php /* カスタム投稿設置 */ add_action('init', 'register_post_type_and_taxonomy'); function register_post_type_and_taxonomy() { register_post_type( 'information', array( 'labels' => array( 'name' => 'お知らせ一覧', 'add_new_item' => 'お知らせを新規追加', 'edit_item' => 'お知らせの編集', ), 'public' => true, 'hierarchical' => false, 'has_archive' => false, 'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail', 'excerpt', 'page-attributes', 'author', ), 'menu_position' => 5, 'rewrite' => array('with_front' => false), 'show_in_rest' => true ) ); /* カテゴリタクソノミーカテゴリの設定 */ register_taxonomy( 'information_category', 'information', array( 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => 'カテゴリ', 'singular_label' => 'information_category', 'public' => true, 'show_ui' => true ) ); /* カスタムタクソノミータグの設定 */ register_taxonomy( 'information_tag', 'information', array( 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => 'タグ', 'singular_label' => 'information_tag', 'public' => true, 'show_ui' => true ) ); }
functions.php には他の記述も有ります。
試したこと
「Classic Editor」プラグインを有効しクラシックエディターに切り替えると、カスタム投稿編集画面にて「カテゴリ」「タグ」が表示されます。
functions.php の記述を必要最小限にしても、「カテゴリ」「タグ」が表示されません。
環境
WordPress 5.0.3
Gutenberg
回答1件
あなたの回答
tips
プレビュー