WordPress.org

Make WordPress Core

#48330 closed defect (bug) (duplicate)

Theme support, removing background image keeps menu item

Reported by: kebbet Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Customize Keywords:
Focuses: ui Cc:

Description

If using add_theme_support( 'custom-background', $args ) in combination with $wp_customize->remove_section( 'background_image' ); there is a menu option in the Customize menu section saying "Background", that leads to a dead end in the customizer. I think that the menu item should be removed if the background_image is disabled.

Change History (4)

#1 @SergeyBiryukov
12 months ago

  • Component changed from Themes to Customize

#2 @desrosj
12 months ago

  • Keywords 2nd-opinion close added

Hi @kebbet,

Can you confirm that the menu item you are referring to is the Appearance > Background link? If so, I am able to reproduce this.

I am not sure that there is a good way to fix this, though. The Customizer is not loaded unless the user is actually in the Customizer, so the admin menu would not be able to know if a plugin or theme is removing the background image section.

To me, this seems like the plugin or theme should also remove this admin submenu item.

Can you talk a bit about your use case and why you're removing the Customizer section for background images instead of removing/not registering theme support?

#3 @kebbet
12 months ago

Hi @desrosj,
I can confirm, see attached image in the issue in the TwentyTwenty theme Github repo. It's the second last item in the image.
https://github.com/WordPress/twentytwenty/issues/858

I suggest looking at issue 480 for Twenty Twenty to see their reason for removing the background image option.
https://github.com/WordPress/twentytwenty/issues/480

For more background discussion about this menu-link, check https://core.trac.wordpress.org/ticket/48338

#4 @desrosj
12 months ago

  • Keywords 2nd-opinion close removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I'm going to close this out as a duplicate of #48338 as there is more discussion there.

Note: See TracTickets for help on using tickets.