0

I'm writing a file upload plugin and want to emulate original Wordpress behavior:

  1. user uploads file on "Upload Files" tab
  2. after upload is complete, "Media Library" tab is activated with just uploaded files selected.

Granted I know how to add a third tab, I want after some to switch to "Media Library" tab, if I could select attachments on the tab, that would be awesome too.

I have browsed docs and js code but failed to find anything. Snippet would be great, pointing to a proper article will suffice.

0

I found nothing better than:

// switch to attachment browser
wp.media.frame.content.mode('browse');
// refresh attachment collection
wp.media.frame.content.view.views._views[".media-frame-content"][0].views._views[""][1].collection.props.set({ignore:(+(new Date()))});

Feel free to add proper way of doing this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.