WordPress.org

Make WordPress Core

Opened 23 months ago

Closed 6 months ago

#24403 closed enhancement (worksforme)

Bug - uploadedTo argument for wp.media

Reported by: jamesmehorter Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.1
Component: Media Keywords: close
Focuses: multisite Cc:

Description

Adding a 'uploadedTo' value for wp.media causes files uploaded in the current frame to not display in the library frame, see attached screenshot. It appears the 'library' state is not updating. The screenshot was taken immediately after dropping an image onto the frame to be uploaded.

Expectation: After dropping a new upload onto the frame, you should see the uploaded file with the currently uploaded files and it should automatically be selected (the exact behavior that is shown without the 'uploadedTo' argument)

Code to reproduce:

<script>
	(function($){
		my_frame = wp.media({
			title: 'Select Your Images',
			button: {
				text: 'Choose'
			},
			multiple: true,
			library: {
				type: 'image',
				uploadedTo: some_post_id  //Only display attachments for current post in the 'Library' state
			}
		});

		my_frame.open();
	})(jQuery);
</script>

Attachments (1)

wp.media frame library state not updating.png (119.9 KB) - added by jamesmehorter 23 months ago.
This is the view seen immediately after uploading an image by dropping it onto the frame

Download all attachments as: .zip

Change History (5)

@jamesmehorter23 months ago

This is the view seen immediately after uploading an image by dropping it onto the frame

comment:1 @nacin23 months ago

  • Cc koopersmith added

comment:3 @ericlewis10 months ago

  • Focuses multisite added
  • Keywords close added
  • Type changed from defect (bug) to enhancement

Related to #26587 (wp.media library argument post_ _not_in breaks the uploads), see comment 2.

This isn't the proper way to interact with the API for this purpose.

comment:4 @wonderboymusic6 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

This works now. There has been so much churn in the past year and a half, I am not sure what the exact fix was.

Note: See TracTickets for help on using tickets.