I am creating a Custom Post Type using register_post_type
. After running the function a new menu item appears in the Admin Panel.
Under this item there are menu items for new_item
and all_items
. Is there a way to get read of the these two options considering that I created a custom page to manage these posts.
You can manipulate the global variable
$submenu
and remove them. In normal circumstances, the index key values are5
(All items) and10
(New item). In this example, the post type isportfolio
:Register the post type with
show_ui
set to false. Like this modified version of the sample in the Codex:Note: With …
… you do not get the menu item but do get the management page if you navigate to the link, so you can remove it from the menu but still have a functioning default edit system if you want.
Edit:
You said that you created a custom page to manage these posts. You must have also registered your own management page for that. I am not sure why you need the generated one. Put another way, I am not sure why you need to overhead of generating those default management pages only to remove the menus. However…
That is copied from another thread, as you can see from the numeric suffix on the function name. The above can cause the whole menu to collapse to the top level only, under the right circumstances, unless there is some other menu in place, which presumable you have but for completeness here is a sort-of dummy menu.