Opened 11 years ago
Closed 7 years ago
#32785 closed enhancement (maybelater)
Removing admin submenu items lack consistency
| Reported by: | paaljoachim | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Menus | Version: | |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | Focuses: | administration |
Description (last modified by )
An easy to understand example to remove a admin submenu item is :
remove_submenu_page( 'plugins.php', 'plugin-install.php' ); remove_submenu_page( 'plugins.php', 'plugin-editor.php' );
Using the add_action admin init one can remove all submenu pages except:
Appearance -> Customize, Header and Background.
I found the following code to remove these sections.
//Remove the custom options provided by the default twentyeleven theme. https://wordpress.org/support/topic/remove-header-and-background-option-pages-in-twenty-eleven-child-theme?replies=11
add_action( 'after_setup_theme','remove_header_background', 100 );
function remove_header_background() {
remove_custom_background();
remove_custom_image_header();
}
function remove_customize_page(){
global $submenu;
unset($submenu['themes.php'][6]); // remove customize link
}
add_action( 'admin_menu', 'remove_customize_page');
Having to add extra code shows lack of consistency. Removing Customize, Header and Background should be just as simple as:
remove_submenu_page( 'themes.php', 'customize.php' ); remove_submenu_page( 'themes.php', 'customize-header.php' ); remove_submenu_page( 'themes.php', 'custom-background.php' );
Change History (7)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Btw here is the tutorial I am working on.
http://easywebdesigntutorials.com/reorder-left-admin-menu-and-add-a-custom-user-role/