Wordpress 无法识别自定义 post 类型和分类法?

Wordpress doesn't recognize the custom post type and taxonomy?

我使用 Simple Custom Post Types 插件来创建新的 Custom Post Types 并且我使用 Simple Taxonomy 插件来创建新的 Taxonomy,但是当我想创建或更新新的 post wordpress 不显示我之前创建的自定义类型或分类。

这是我的代码:

add_action( 'init', 'register_my_cpt_video', 10 );

function register_my_cpt_video() {
    register_post_type( "video", array (
        'labels' => 
        array (
            'name' => 'Vidéos',
            'singular_name' => 'Vidéo',
            'add_new' => 'Ajouter',
            'add_new_item' => 'Ajouter une nouvelle vidéo',
            'edit_item' => 'Modifier la vidéo',
            'new_item' => 'Nouvelle vidéo',
            'view_item' => 'Voir la vidéo',
            'search_items' => 'Chercher une vidéo',
            'not_found' => 'Aucune vidéo trouvée',
            'not_found_in_trash' => 'Aucune vidéo trouvée dans la corbeille',
            'parent_item_colon' => 'Vidéo parente:',
        ),
        'description' => '',
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'map_meta_cap' => true,
        'capability_type' => 'post',
        'public' => true,
        'hierarchical' => false,
        'rewrite' => 
        array (
            'slug' => 'video',
            'with_front' => true,
            'pages' => true,
            'feeds' => true,
        ),
        'has_archive' => true,
        'query_var' => 'video',
        'supports' => 
        array (
            0 => 'title',
            1 => 'editor',
            2 => 'thumbnail',
            3 => 'comments',
        ),
        'taxonomies' => 
        array (
            0 => 'category_video',
        ),
        'show_ui' => true,
        'menu_position' => 30,
        'menu_icon' => false,
        'can_export' => true,
        'show_in_nav_menus' => true,
        'show_in_menu' => false,
    ) );
}

有什么想法吗? 提前致谢。

最后一个元素(show_in_menu)设置为假,将其设置为真(https://codex.wordpress.org/Function_Reference/register_post_type#show_in_menu

我的做法略有不同,方法是在 functions.php 文件中使用下面的这段代码(实际上作为包含以保持整洁)。此代码创建 "sign" 自定义 post 类型和 "signs" 的自定义类别(这是针对本地标志店)。希望你能参考这个,这对你有帮助....

<?php       
//Custom Post Type Code
function my_custom_post_types(){
register_post_type('sign', 
    array(  'label' => 'Sign',
            'description' => 'Sign',
            'public' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'has_archive' => true,
            'rewrite' => array('slug' => 'signs'),
            'query_var' => true,
            'publicly_queryable' => true,
            'supports' => array('title','editor', 'excerpt'),   
            'taxonomies' => array('signcategory'),
            'menu_icon'=> 'dashicons-star-filled',          
            'labels' => array (
                          'name' => 'Signs',
                          'singular_name' => 'Sign',
                          'menu_name' => 'Signs',
                          'add_new' => 'Add Sign',
                          'add_new_item' => 'Add Sign',
                          'edit' => 'Edit',
                          'edit_item' => 'Edit Sign',
                          'new_item' => 'New Sign',
                          'view' => 'View Sign',
                          'view_item' => 'View Sign',
                          'search_items' => 'Search Signs',
                          'not_found' => 'No Signs Found',
                          'not_found_in_trash' => 'No Sign Found in Trash',
                          'parent' => 'Parent Sign',
                                ),
                        )
                );          

}       
add_action('init', 'my_custom_post_types'); 

//Custom Taxonomy Code (For sign CPT)
register_taxonomy('signcategory',
    array ( 0 => 'signcategory',),
    array( 'hierarchical' => true, 
            'label' => 'Sign Type',
            'show_ui' => true,
            'query_var' => true,
            'rewrite' => true,
            'show_in_nav_menus' => true,
            'show_admin_column' => true,                
            'singular_label' => 'Menu'
        ) 
    );  
?>