Is it possible to hide or remove some custom post type from here?
2 Answers
// 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:
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.
-
+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 thescreen option
.– FayazCommented Feb 16, 2017 at 9:55 -
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:
From there, show or hide as you need.