我在WordPress的4.8.1。出於某種原因,當我註冊自定義類型後,我補充一下:WordPress的不能添加類別自定義帖子類型
'taxonomies' => ['category'],
它不工作。類別不會顯示在自定義帖子類型編輯屏幕上。它一直在工作,所以我不明白爲什麼現在不行。它幾個月前甚至在網站上工作。有人幫助:)
!! UPDATE !!
這裏是我的代碼,我意識到這是必要的笑
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我添加了我的整個代碼 –