Make WordPress Core

Opened 6 years ago

Closed 2 years ago

#32785 closed enhancement (maybelater)

Removing admin submenu items lack consistency

Reported by: paaljoachim Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Menus Keywords: needs-patch
Focuses: administration Cc:

Description (last modified by ocean90)

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() {
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)

#2 @ocean90
6 years ago

  • Description modified (diff)

#3 @paaljoachim
6 years ago

Thank you for adjusting the description ocean90..:)

#4 @welcher
5 years ago

  • Keywords needs-patch added

#5 @welcher
5 years ago

@paaljoachim did you want to try adding a patch for this?

#6 @paaljoachim
5 years ago

I will look into it.

Last edited 5 years ago by paaljoachim (previous) (diff)

#7 @paaljoachim
2 years ago

  • Resolution set to maybelater
  • Status changed from new to closed

Lets just close this issue. As I never followed up on it.

Note: See TracTickets for help on using tickets.