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.

I follow instruction on this page to remove some admin menus.

http://codex.wordpress.org/Function_Reference/remove_menu_page

But is seems it only works on default wp admin menus. Admin menu added by plugins is not getting removed.

For example, I tried removing admin menu of wordpress seo by yoast using

remove_menu_page( 'admin.php?page=wpseo_dashboard' );

But the menu remains there. All other standard wp admin menus were removed except wp seo by yoast.

Any idea how can I also remove admin menu of plugins?

I saw some similar questions but the recommended codes doesn't seem to be 3.8.1 compatible so I added this question to start a new fresh question specific to 3.8.1

Thanks

share|improve this question
1  
You must ensure to call remove_menu_page after the page is added. Do you know which hook WP Seo by Yoast is using to add the menu page? When you find it, use same hook with a lower priority. –  G. M. Feb 2 at 23:16
    
How will I know the hook? –  Charles Wayne Feb 3 at 8:50
    
Search the source code... –  G. M. Feb 3 at 9:00
add comment

1 Answer

up vote 0 down vote accepted
add_action('admin_menu', 'remove_wpseo_admin_menu_links');

function remove_wpseo_admin_menu_links(){

remove_action( 'admin_bar_menu', 'wpseo_admin_bar_menu', 95 );

remove_menu_page( 'wpseo_dashboard' );


}
share|improve this answer
    
Thanks. That did it. So, for me to get rid of several plugin admin menu, I have to look for their hook and use remove action? What if I have five admin menu to remove, I have to search for all of their hooks? Is there no way to ad action that will eliminate it regardless. Or perhaps a reverse way, to force WP admin to show only specified admin menu ad disregard anything not specified on the function. This is one down anyway. Thanks for the answer edit sorry i do not have enough rep yet to vote up. –  Charles Wayne Feb 3 at 9:59
    
Depends. Which menu links specifically? –  Brad Dalton Feb 3 at 11:04
    
Thanks.. Perhaps I will just contact the author since the plugins are premium ones. –  Charles Wayne Feb 3 at 13:37
    
is there no way to call the function that remove the links after all pages has been called? making sure that it will be included when remove function is called? –  Charles Wayne Feb 9 at 9:48
add comment

Your Answer

 
discard

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.