Make WordPress Core

Opened 4 months ago

Last modified 3 months ago

#48236 new defect (bug)

Media attachment browser no longer provides id of attachment

Reported by: slebog Owned by:
Milestone: 5.4 Priority: normal
Severity: normal Version: 5.2.3
Component: Media Keywords: has-patch needs-testing
Focuses: accessibility, administration Cc:
PR Number:


This is a follow-up to #47458.

Issue #47458 removed the data-id attribute from the media attachment browser. This was a useful attribute, used by an (internal) plugin on our site to access the details of the currently displayed attachment. We used code similar to this to hook into the dialog:

wp.media.view.Attachment.Details.prototype.on('ready', function() {
	var postid = $('.attachment-details').data('id'),
		details = wp.media.attachment(postid);
	// do stuff with details

This functionality is now broken, and I can’t see another way to access the id of the attachment details being shown. (The item id in the query string is not reliable, as it’s not always updated in time, or at all.)

Could this useful attribute be restored? It doesn’t seem to affect the problem addressed in #47458 in any way.

Attachments (1)

48236.diff (601 bytes) - added by slebog 4 months ago.

Download all attachments as: .zip

Change History (7)

4 months ago

#1 @slebog
4 months ago

  • Keywords has-patch added

#2 @SergeyBiryukov
4 months ago

  • Milestone changed from Awaiting Review to 5.3
  • Version set to 5.2.3

#3 @peterwilsoncc
4 months ago

  • Milestone changed from 5.3 to 5.2.4

Moving to the 5.2.4 milestone as this was introduced in a point release so ought to be back ported for sites affected by the auto update.

This ticket was mentioned in Slack in #core by marybaum. View the logs.

4 months ago

#5 @desrosj
3 months ago

  • Milestone changed from 5.2.4 to 5.2.5

Punting to 5.2.5 as 5.2.4 was just released.

#6 @desrosj
3 months ago

  • Keywords needs-testing added
  • Milestone changed from 5.2.5 to 5.4

Unfortunately, with the impending 5.3 RC1, time has run out for this one.

I am going to punt to 5.4 for now, but it can be moved up into a minor when ready.

Note: See TracTickets for help on using tickets.