WordPress.org

Make WordPress Core

#22215 closed defect (bug) (fixed)

Customizer Custom Background does not set context

Reported by: kovshenin Owned by: nacin
Milestone: 3.5 Priority: high
Severity: normal Version: 3.4
Component: Appearance Keywords: has-patch commit
Focuses: Cc:

Description

Steps to reproduce:

  • Activate a theme with Custom Background support
  • Fire up the Customizer and upload a new background image, save changes.
  • Browse to the Media Library and find your new image

Expected context is "Background Image" but no context shows up. This bug also prevents background images uploaded through the Customizer to show up in its own Uploaded tab. It looks like the context is not being passed to ajax-actions.php by customize-controls.js.

Attachments (1)

22215.diff (1012 bytes) - added by kovshenin 18 months ago.
Uses a control.uploader.params object to set the context and theme, which is then passed to the Uploader.

Download all attachments as: .zip

Change History (6)

comment:1 kovshenin18 months ago

  • Version changed from 3.4.2 to 3.4

Confirmed this has been broken since 3.4 for Custom Background. However, Custom Header did pass the context on upload in 3.4, but the Custom Header upload functionality was removed from the Customizer in 3.4.2.

kovshenin18 months ago

Uses a control.uploader.params object to set the context and theme, which is then passed to the Uploader.

comment:2 follow-up: kovshenin18 months ago

  • Keywords has-patch added

In 22215.diff removing the use of this.uploader.supported which apparently is empty at that stage, and not using the control.uploader.param function, which is not defined when that code runs. Using a control.uploader.params object directly which is passed to the Uploader when it's created. Not entirely sure this is the right approach to solve this, feedback appreciated.

comment:3 nacin18 months ago

  • Milestone changed from Awaiting Review to 3.5
  • Priority changed from normal to high

comment:4 in reply to: ↑ 2 koopersmith18 months ago

  • Keywords commit added

+1

Replying to kovshenin:

In 22215.diff removing the use of this.uploader.supported which apparently is empty at that stage, and not using the control.uploader.param function, which is not defined when that code runs. Using a control.uploader.params object directly which is passed to the Uploader when it's created. Not entirely sure this is the right approach to solve this, feedback appreciated.

This is exactly the right approach to solve this. Since the wp.Uploader instance is created right after this code runs, we should use the params key (which you correctly did) instead of trying to use the wp.Uploader methods.

comment:5 nacin18 months ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 22484:

Properly set upload context when uploading a background image through the customizer. props kovshenin. fixes #22215.

Note: See TracTickets for help on using tickets.