Tell me more ×
WordPress Answers 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
2  
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 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 at 10:01

2 Answers

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

is it what you are looking for

wp.media.editor.remove('content');
wp.media.editor.add('content');
share|improve this answer
Please explain why that could solve the problem. – toscho Feb 26 at 12:25

Your Answer

 
discard

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.