[wp-trac] [WordPress Trac] #32785: Removing admin submenu items lack consistency
WordPress Trac
noreply at wordpress.org
Tue Aug 11 08:29:32 UTC 2015
#32785: Removing admin submenu items lack consistency
-------------------------+------------------------------
Reporter: paaljoachim | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version:
Severity: normal | Resolution:
Keywords: | Focuses: administration
-------------------------+------------------------------
Description changed by ocean90:
Old description:
> 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' );
New description:
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' );
}}}
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32785#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list