Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to figure out how it's possible to 'refresh' the media library in the new media dialogue in 3.5. I'm adding images from an external image library to the WordPress library (via a tab/iFrame combo in the media dialogue) which works ok, but I have to close and reopen the dialogue in order to show the newly added images (which have successfully been aded to the library).

I know there are wp.media.editor.open() and wp.media.editor.close() methods, but I can't quite manage to find a sort() or refresh() (or whatever) in the source. Truth be told, the source code is pretty intense reading and console.log doesn't seemingly help much with backbone.js. Any ideas?

share|improve this question
One more Question to the gallery "New Media Manager: The Great Unknown". By the rhythm it goes, I expect full documentation and hooks around WP 3.7... All the upvotes indicate a hungry community. –  brasofilo Feb 12 '13 at 4:50
Instead of refresh() function , we can use combination of wp.media.editor.close() and wp.media.editor.open() function to achieve the desired output. –  Vinod Dalvi Feb 18 '13 at 10:01

2 Answers 2

is it what you are looking for

share|improve this answer
Please explain why that could solve the problem. –  toscho Feb 26 '13 at 12:25

Took me a couple days but I finally dug my way through things enough to figure this out:

wp.media.editor.get(wpActiveEditor).views._views[".media-frame-content"][0].views._views[""][1].collection.props.set({ignore:(+(new Date()))})

Seems like there must be an easier way but that works for me in the meantime!

share|improve this answer
seems so intuitive :) nevertheless, this works!! THANK YOU!!! –  Andrej Jun 24 '13 at 18:58
just found a "more official" way to do it: wp.media.frame.content.get('gallery').collection.props.set({ignore: (+ new Date())});, in this case i'm refreshing the gallery tab. –  Jermim bilal Apr 21 '14 at 17:31
While both commands do trigger a refresh, afterwards you can no longer add images in the modal :( need another solution to this –  Benjamin Jun 21 '14 at 13:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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