Wordpress Custom Post Types doesn't show in admin left sidebar menu

user2475614 picture user2475614 · Jun 11, 2013 · Viewed 22.3k times · Source

I have a weird problem with one of my custom post type that doesn't show in left sidebar admin menu.

I declared 5 custom post types but the fifth doesn't show in left menu. Here it's the Clients post type that doesn't show. I made a lot of search about this, without success.

Thanks a lot for your help !

    /**
 * Custom Posts Types
 */

add_action('init', 'create_team_post_type');
function create_team_post_type() {
    register_post_type( 'phil_team',
        array(
            'labels' => array(
                'name' => __('Équipe'),
                'singular_name' => __('Individu'),
                'add_new' => __('Ajouter'),
                'add_new_item' => __('Ajouter un individu'),
                'view_item' => __('Voir individu'),
                'edit_item' => __('Modifier individu'),
                'search_items' => __('Rechercher un individu'),
                'not_found' => __('Individu non trouvé'),
                'not_found_in_trash' => __('Individu non trouvé dans la corbeille')
            ),
            'public' => true,
            'hierarchical' => false,
            'menu_position' => 21,
            'rewrite' => array('slug' => 'team'),
            'supports' => array('title', 'editor', 'thumbnail'),
            'show_ui' => true
        )
    );
}

add_action('init', 'create_projects_post_type');
function create_projects_post_type() {
    register_post_type( 'phil_projects',
        array(
            'labels' => array(
                'name' => __('Projets'),
                'singular_name' => __('Projet'),
                'add_new' => __('Ajouter'),
                'add_new_item' => __('Ajouter un projet'),
                'view_item' => __('Voir projet'),
                'edit_item' => __('Modifier projet'),
                'search_items' => __('Rechercher un projet'),
                'not_found' => __('Projet non trouvé'),
                'not_found_in_trash' => __('Projet non trouvé dans la corbeille')
            ),
            'public' => true,
            'menu_position' => 21,
            'query_var' => 'project',
            'rewrite' => array('slug' => 'who-we-help/our-work'),
            'supports' => array('title', 'editor', 'thumbnail'),
            'show_ui' => true
        )
    );

    $set = get_option('post_type_rules_flased_POST-TYPE-NAME-HERE');
    if ($set !== true){
       flush_rewrite_rules(false);
       update_option('post_type_rules_flased_POST-TYPE-NAME-HERE',true);
}
}

add_action('init', 'create_slideshow_post_type');
function create_slideshow_post_type() {
    register_post_type( 'phil_home_slideshow',
        array(
            'labels' => array(
                'name' => __('Slideshow'),
                'singular_name' => __('Image'),
                'add_new' => __('Ajouter'),
                'add_new_item' => __('Ajouter une image'),
                'view_item' => __('Voir image'),
                'edit_item' => __('Modifier image'),
                'search_items' => __('Rechercher une image'),
                'not_found' => __('Image non trouvé'),
                'not_found_in_trash' => __('Image non trouvé dans la corbeille')
            ),
            'public' => true,
            'hierarchical' => false,
            'menu_position' => 21,
            'rewrite' => array('slug' => 'slideshow'),
            'supports' => array('title', 'editor', 'thumbnail'),
            'show_ui' => true
        )
    );
}

add_action('init', 'create_home_boxes_post_type');
function create_home_boxes_post_type() {
    register_post_type( 'phil_home_boxes',
        array(
            'labels' => array(
                'name' => __('Boîtes page d\'accueil'),
                'singular_name' => __('Boîte'),
                'add_new' => __('Ajouter'),
                'add_new_item' => __('Ajouter une boîte'),
                'view_item' => __('Voir boîte'),
                'edit_item' => __('Modifier boîte'),
                'search_items' => __('Rechercher une boîte'),
                'not_found' => __('Boîte non trouvé'),
                'not_found_in_trash' => __('Boîte non trouvé dans la corbeille')
            ),
            'public' => true,
            'hierarchical' => false,
            'menu_position' => 21,
            'supports' => array('title', 'editor', 'thumbnail'),
            'show_ui' => true
        )
    );
}

add_action('init', 'create_clients_post_type');
function create_clients_post_type() {
    register_post_type( 'phil_clients',
        array(
            'labels' => array(
                'name' => __('Clients'),
                'singular_name' => __('Client'),
                'add_new' => __('Ajouter'),
                'add_new_item' => __('Ajouter un client'),
                'view_item' => __('Voir client'),
                'edit_item' => __('Modifier client'),
                'search_items' => __('Rechercher une client'),
                'not_found' => __('Client non trouvé'),
                'not_found_in_trash' => __('Client non trouvé dans la corbeille')
            ),
            'public' => true,
            'show_ui' => true,
            'hierarchical' => false,
            'menu_position' => 21,
            'supports' => array('title', 'editor', 'thumbnail')
        )
    );
}

Answer

Tihomir Mihaylov picture Tihomir Mihaylov · Sep 25, 2014

This case does not seem to be the same, but one reason for not showing in the left admin menu is the length of the name of the post type is longer than 20 characters Function Reference/register post type