私はWordpress 4.8.1です。何らかの理由で私は、カスタムポストタイプを登録して、私が追加した場合:Wordpressはカスタムポストタイプにカテゴリを追加できません
'taxonomies' => ['category'],
それは動作しません。カスタム投稿タイプ編集画面にはカテゴリは表示されません。それはいつも前に働いたので、なぜ今はうまくいかないのか分からない。数ヶ月前にはサイトでも作業していました。誰か助けてください:)
!! 更新 !!ここ
が私のコードであり、Iは
function spanish_cpt() {
$labels = array(
'name' => _x('Spanish', 'post type general name'),
'singular_name' => _x('Spanish Post', 'post type singular name'),
'add_new' => _x('Add New', 'book'),
'add_new_item' => __('Add New Spanish Post'),
'edit_item' => __('Edit Spanish Post'),
'new_item' => __('New Spanish Post'),
'all_items' => __('All Spanish Posts'),
'view_item' => __('View Spanish Post'),
'search_items' => __('Search Spanish Posts'),
'not_found' => __('No spanish posts found'),
'not_found_in_trash' => __('No spanish posts found in the Trash'),
'parent_item_colon' => '',
'menu_name' => 'Spanish'
);
$args = array(
'labels' => $labels,
'description' => 'Spanish version of posts',
'public' => true,
'menu_position' => 5,
'supports' => array('title', 'editor', 'thumbnail',
'author', 'comments', 'revisions'),
'has_archive' => 'es',
'taxonomies' => array('category', 'post_tag'),
);
register_post_type('spanish', $args);
}
add_action('init', 'spanish_cpt');
@silverが言ったように、コード全体を – silver
として追加してください。このビットは実際には正しいので、完全なコードがないと何が間違っていると言うのは難しいです。 –
@silver私のコード全体を追加しました –