WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After checking out: http://codex.wordpress.org/Function_Reference/remove_menu_page,
I successfully use the following code to hide some stuff from the menu:

add_action( 'admin_menu', 'my_remove_menu_pages' );

function my_remove_menu_pages() {

However both the "posts page" and a custom post types page seems to run on /wp-admin/edit.php.

So I'm looking for a way to hide the posts menubar but still show the menu for a custom post type I've added.

share|improve this question
up vote 8 down vote accepted

Doing this search, I've found this fine answer by Chris_O. There's even a jQuery solution I proposed there.

Anyway, the function remove_menu_page('edit.php'); only removes the Posts menu.

But, as we learn from Chris answer, remove_menu_page('edit.php?post_type=athletes'); removes the Custom Post Type menu.

To really block access to the URL, as we're merely hiding the menu item, check the following Q&A: Blocking Administrative Access to Authors and Subcribers?

share|improve this answer
Of course, athletes is the name of my Custom Post Type... Adjust as necessary. – brasofilo Jul 5 '12 at 0:59
It works! cool! Thanks for showing how I could've searched! – Alisso Jul 5 '12 at 1:16
Can I choose two right answers? – Alisso Jul 5 '12 at 1:16
@Alisso No. You can only choose one. Since both show the same solution in part, you might want to choose one has the all (or most) the necessary details you need. :) – its_me Jul 5 '12 at 4:14
This function doesn't remove anything, it merely hides it. – Piet Oct 15 '15 at 3:49

I just tried and remove_menu_page('edit.php'); only removes the Posts Top Level Menu.

All my other custom post types (and I have a lot) still work fine. I have a feeling this is because it does a direct lookup of the exactly slug, not the basename of the file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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