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?
The correct way of refreshing the content of the frame, as found in the WP core, is as below:
You should always check of the content is available, else refresh the library.
Cheers!
Took me a couple days but I finally dug my way through things enough to figure this out:
Seems like there must be an easier way but that works for me in the meantime!
2019 update. I found a better solution that doesnt break the uploader:
is it what you are looking for