[wp-trac] [WordPress Trac] #30969: adding theme support for 'custom-header' or 'custom-background' results to duplicate admin menu items

WordPress Trac noreply at wordpress.org
Tue Mar 10 19:40:42 UTC 2020


#30969: adding theme support  for  'custom-header' or 'custom-background' results
to duplicate admin menu items
--------------------------+-----------------------------
 Reporter:  edville101    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:
Component:  Customize     |     Version:  4.1
 Severity:  normal        |  Resolution:
 Keywords:  2nd-opinion   |     Focuses:  administration
--------------------------+-----------------------------
Changes (by johnjamesjacoby):

 * keywords:   => 2nd-opinion
 * status:  closed => reopened
 * resolution:  invalid =>


Old description:

> 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.

New description:

 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.

--

Comment:

 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/30969#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list