3

Is it possible to hide or remove some custom post type from here? here are the screenshot

1
  • 1
    Please have a look at "How to ask". What have you tried so far, where do you stumble, what does not work ?
    – flomei
    Commented Feb 16, 2017 at 7:46

2 Answers 2

4
// set up the arguements for post type
$labels = array(....);
$args =
        array(
            'labels' => $labels,
            'public' => true, // display on menu and site
            'publicly_queryable' => false,
            'show_ui' => true,
            'query_var' => false,
            'rewrite' => false,
            'capability_type' => 'post',
            'hierarchical' => false,
            'menu_position' => 111,
            'supports' =>
            array(
                'title'
            )
);
// register the post type
register_post_type(__('galery'), $args);

If the 'public' => true is true, then a post type will appear in the menu and site.

If the 'public' => false - hidden in the menu and site.

If you want to show on the site but hidden in the menu, there is a special option: 'show_in_nav_menus' => true

Example:

$labels = array(....);
    $args =
            array(
                'labels' => $labels,
                'public' => true, // display on menu and site
                'show_in_nav_menus' => false // hiden on menu
                'publicly_queryable' => false,
                'show_ui' => true,
                'query_var' => false,
                'rewrite' => false,
                'capability_type' => 'post',
                'hierarchical' => false,
                'menu_position' => 111,
                'supports' =>
                array(
                    'title'
                )
    );
    // register the post type
    register_post_type(__('payout'), $args);

If you can not edit register_post_type You can Hide use css. To click in the browser f12 and find id element:

enter image description here

in my case, to add to the styles admin:

    #add-kleo-nav-menu {
    display: none;
}

If there is a question how to add styles in admin area - ask.

Sorry for my English.

2
  • +1 for the CODE solution, however, hiding it using CSS in the admin panel is not a good idea. You have Screen Options for that. See my answer for the screen option.
    – Fayaz
    Commented Feb 16, 2017 at 9:55
  • I completely agree
    – TrubinE
    Commented Feb 16, 2017 at 17:50
2

If you have created the custom post type correctly, hiding it should be easy.

First, from your your Admin Panel, go to:

Appearance -> Menus

Then, from there at the top right, you'll see Screen Options button. If you click that button, it'll show you the option to show & hide Pages, Posts, Your Custom Post Type, Categories, Tags etc. Like the following:

enter image description here

From there, show or hide as you need.

1
  • yes right ans :)
    – ma_dev_15
    Commented Feb 16, 2017 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.