Skip to content

Instantly share code, notes, and snippets.

@enqtran
Last active May 5, 2017 04:13
Show Gist options
  • Save enqtran/3ecde76a380541907cf214181d2948a7 to your computer and use it in GitHub Desktop.
Save enqtran/3ecde76a380541907cf214181d2948a7 to your computer and use it in GitHub Desktop.
**
* remove menu admin.
*/
if ( !function_exists( 'remove_menus' ) ) {
function remove_menus() {
if ( !current_user_can('administrator') ) {
remove_menu_page( 'index.php' ); //Dashboard
remove_menu_page( 'users.php' );
remove_menu_page( 'edit-comments.php' );
remove_menu_page( 'upload.php' ); //Media
remove_menu_page( 'edit.php' ); //post
remove_menu_page( 'edit.php?post_type=page' ); //Pages
// remove_menu_page( 'edit.php?post_type=reviews' ); //Pages
remove_menu_page( 'edit.php?post_type=plans' ); //Plans
// remove_menu_page( 'edit.php?post_type=news' ); //Pages
remove_menu_page( 'themes.php' ); //Appearance
remove_menu_page( 'plugins.php' ); //Plugins
remove_menu_page( 'tools.php' ); //Tools
remove_menu_page( 'options-general.php' ); //Settings
}
remove_menu_page( 'edit-comments.php' );
}
add_action( 'admin_menu', 'remove_menus' , 999 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment