Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#48241 new enhancement

Using `add_theme_support( 'custom-background' )` enables both background color and background image.

Reported by: williampatton's profile williampatton Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:


Both custom color and custom image options for appear in the customizer when add_theme_support( 'custom-background' ) is defined. In some instances it is designer preference to have no custom color option or no custom image option. Currently it is not possible to have one or the other - it is both or none.

The code responsible for this is here:

It could be adjusted to first detect a newly added default value before adding the support. That way would keep it working in a backwards compatible way while allowing others to pick and choose which their theme supports going forward.

Change History (1)

#1 @afercia
5 years ago

A specific case where this was an issue is Twenty Twenty, where in a first time custom background was supported and at the same time the background image section in the customizer was removed, see #48338. The initial intent was to support only custom background color, but that particular set-up led to a clear problem in the core admin menu.

Seems a legitimate case that theme authors may want to support either a custom background image or a custom background color.

On the related GitHub issue two possible options were mentioned, see

  • either split the support into 2 separate background support: 1) for image and 2) for color
  • or change the "Background Image" customizer section to a generic "Background" one, capable to handle both color and / or image
Note: See TracTickets for help on using tickets.