WordPress.org

Make WordPress Core

Opened 6 years ago

Last modified 8 months ago

#30969 reopened defect (bug)

adding theme support for 'custom-header' or 'custom-background' results to duplicate admin menu items

Reported by: edville101 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: Customize Keywords: 2nd-opinion
Focuses: administration Cc:

Description (last modified by johnjamesjacoby)

Wordpress 4.1 shows double 'Header' and 'Background' menu items in admin navigation menu on front-end when using
add_theme_support( 'custom-header', $args );
add_theme_support( 'custom-background', $args );

Here is a screenshot of Twentyfourteen theme.

http://snag.gy/djDFm.jpg

This issue also exists in other themes I tested using the above hooks.
This issue is not seen in previous WordPress version using the Twentyfourteen theme.

Change History (6)

#1 @SergeyBiryukov
6 years ago

  • Component changed from General to Customize

Related: [30459]

#2 follow-up: @celloexpressions
6 years ago

@edville101: what broswer and version are you using? Is JavaScript enabled? Can you reproduce with all plugins deactivated?

For some reason, hide-if-customize OR hide-if-no-customize isn't working.

#3 @celloexpressions
6 years ago

  • Keywords reporter-feedback added

#4 in reply to: ↑ 2 @edville101
6 years ago

Replying to celloexpressions:

@edville101: what broswer and version are you using? Is JavaScript enabled? Can you reproduce with all plugins deactivated?

For some reason, hide-if-customize OR hide-if-no-customize isn't working.

Thank you.
I was able to confirm that a popup form plugin's javascript is causing this problem

$( '#wpadminbar' ).appendTo( 'html' ).show();

#5 @SergeyBiryukov
6 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

#6 @johnjamesjacoby
8 months ago

  • Description modified (diff)
  • Keywords 2nd-opinion added
  • Resolution invalid deleted
  • Status changed from closed to reopened

I just ran into this. ⏳

I think it is strange that WordPress hides these submenu items with CSS, when it could simply prevent them from ever being added in the first place.

I did some research, and it seems like Custom_Background::init() and Custom_Image_Header::init() could both have the same relative conditional logic inside of menu.php to not add the pages, in turn not adding the submenu items.

Header:

if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize' ) ) {
    return;
}

Background:

if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize' ) ) {
    return;
}

Are there any un'obvious reasons to add these pages, even though they are not directly visited by a user anymore? The Customizer appears to work normally without them, as do the themes and theme settings.

Note: See TracTickets for help on using tickets.