Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

2 Answers 2

up vote 6 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.

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

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.