0

I follow instruction on this page to remove some admin menus: remove_menu_page()

But is seems it only works on default 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 WordPress admin menus were removed except Yoast SEO.

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

  • 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. – gmazzap Feb 2 '14 at 23:16
  • How will I know the hook? – Charles Wayne Feb 3 '14 at 8:50
  • Search the source code... – gmazzap Feb 3 '14 at 9:00
2
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' );


}
  • 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 '14 at 9:59
  • Depends. Which menu links specifically? – Brad Dalton Feb 3 '14 at 11:04
  • Thanks.. Perhaps I will just contact the author since the plugins are premium ones. – Charles Wayne Feb 3 '14 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 '14 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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