Skip to content

Instantly share code, notes, and snippets.

@ofernandolopes
Last active August 29, 2015 14:21
Show Gist options
  • Save ofernandolopes/bdfca438ccd64825864f to your computer and use it in GitHub Desktop.
Save ofernandolopes/bdfca438ccd64825864f to your computer and use it in GitHub Desktop.
WordPress - Remove menus and sub-menus
//Remove menus and sub-menus
function remove_menus(){
remove_menu_page( 'edit.php' ); // Posts
remove_menu_page( 'upload.php' ); // Media
remove_menu_page( 'link-manager.php' ); // Links
remove_menu_page( 'edit-comments.php' ); // Comments
remove_menu_page( 'edit.php?post_type=page' ); // Pages
remove_menu_page( 'plugins.php' ); // Plugins
remove_menu_page( 'themes.php' ); // Appearance
remove_menu_page( 'users.php' ); // Users
remove_menu_page( 'tools.php' ); // Tools
remove_menu_page( 'options-general.php' ); // Settings
remove_submenu_page ( 'index.php', 'update-core.php' ); // Dashboard->Updates
remove_submenu_page ( 'themes.php', 'themes.php' ); // Appearance-->Themes
remove_submenu_page ( 'themes.php', 'customize.php' ); // Aparência -> Personalizar
remove_submenu_page ( 'themes.php', 'widgets.php' ); // Appearance-->Widgets
remove_submenu_page ( 'themes.php', 'theme-editor.php' ); // Appearance-->Editor
remove_submenu_page ( 'options-general.php', 'options-general.php' ); // Settings->General
remove_submenu_page ( 'options-general.php', 'options-writing.php' ); // Settings->writing
remove_submenu_page ( 'options-general.php', 'options-reading.php' ); // Settings->Reading
remove_submenu_page ( 'options-general.php', 'options-discussion.php' ); // Settings->Discussion
remove_submenu_page ( 'options-general.php', 'options-media.php' ); // Settings->Media
remove_submenu_page ( 'options-general.php', 'options-privacy.php' ); // Settings->Privacy
}
if (!current_user_can( 'manage_options' )) {
add_action( 'admin_menu', 'remove_menus' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment