Wednesday, 27 November 2013

Hide / Remove Menu and SubMenu in wordpress Admin Panel

Remove a top level admin menu.
remove_menu_page( $menu_slug )
Here menu_slug has menu's slugname or page


Remove an admin submenu.
remove_submenu_page( $menu_slug, $submenu_slug )

Use following php code for theme's function.php
Ex:- for slug name
add_action( 'admin_menu', 'adjust_the_wp_menu', 999 );
function adjust_the_wp_menu() {
  $page =remove_menu_page( 'plugins' );
  $page = remove_submenu_page( 'themes', 'widgets' ); // widget page under themes
}
Ex:- for filename/page
add_action( 'admin_menu', 'adjust_the_wp_menu', 999 );
function adjust_the_wp_menu() {
  $page =remove_menu_page( 'plugins.php' );  
  $page = remove_submenu_page( 'themes.php', 'widgets' ); // widget page under themes
}

No comments:

Post a Comment