Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#22774 closed defect (bug) (fixed)

attachment_fields_to_save filter doesn't run for attachment saves (w/o alt text set)

Reported by: sc0ttkclark's profile sc0ttkclark Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch commit
Focuses: Cc:


Currently, 3.5 trunk doesn't run the 'attachment_fields_to_save' filter when you don't set the alt text.

Attachments (3)

22774.patch (1.4 KB) - added by sc0ttkclark 11 years ago.
22774.2.patch (1.4 KB) - added by sc0ttkclark 11 years ago.
Once more, minus compulsive formatting
22774.diff (642 bytes) - added by nacin 11 years ago.

Download all attachments as: .zip

Change History (12)

11 years ago

#1 @sc0ttkclark
11 years ago

  • Keywords has-patch dev-feedback added

#2 @nacin
11 years ago

  • Keywords commit added; dev-feedback removed

11 years ago

Once more, minus compulsive formatting

#3 @nacin
11 years ago

  • Milestone changed from Awaiting Review to 3.5

#4 @nacin
11 years ago

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

In 23088:

Fix branchhing in edit_post() where attachment_fields_to_save would only run when the alt text was sent. It should run whenever an attachment is saved. props sc0ttclark. fixes #22774.

#5 @sc0ttkclark
11 years ago

As I review further, when saving an attachment this filter won't run because it has no attachments in the $post_data[ 'attachments' ]

As it is right now, it appears this won't work in conjunction with the old attachment_fields_to_edit:

#6 @nacin
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

11 years ago

#7 @nacin
11 years ago

In the old modal, we were *always* sending back $_POST['attachments'][ ID ][ field ]. In the new modal, there might not be any fields. But we should still run the filter, as get_attachment_fields_to_edit() allowed for raw HTML to be inserted. (FUN.)

has-patch commit remains.

#8 @sc0ttkclark
11 years ago

This resolves that issue (for backwards compatibility). I'll work on updating everything for the new workflow.

#9 @markjaquith
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 23094:

Run the attachment_fields_to_save filter even if we don't get the fields we used to get. props nacin. fixes #22774

Note: See TracTickets for help on using tickets.