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.
Related Posts:
- WP3.5 Media Uploader – how to make it accept multiple images?
- Trigger refresh for new media manager in 3.5
- Extend Media Library
- WordPress 3.5: Setting custom “full URL path to files” in the Media Library?
- How to show all available images in WP’s media library when using the Polylang plugin?
- Which filters or actions to use after a media upload and delete?
- Display attachments by ID in a wp.media frame
- Protecting direct access to PDF and ZIP unless user logged in (without plugin)
- How to wp_upload_bits() to a sub-folder?
- “Add Media” only shows “Full Size” under Attachment Display Settings
- Where do the favicons for Media Files come from
- WP 3.5 media manager – how to create a working gallery frame
- Is it possible to trigger some JavaScript when Media Popup is opened?
- How to call WP3.5 Media Library manager?
- Refresh wp.media after ajax call
- Password protect some uploaded files, so only logged-in users can view them
- How to protect uploads in multisite if user is not logged in?
- Trigger JS when featured image upload window is opened in admin
- Append button to WordPress Image Details modal
- How to get the image url in the input box from media library?
- How to disable WordPress Media resize different size version?
- Restrict file types in the uploader of a wp.media frame
- Media library storing files in uploads not folders within in uploads
- Add select field to media uploader that adds a class to the image
- How to host different file formats/types for a media attachment without creating multiple attachments?
- Site icons with alpha channel for self-hosted WordPress blog network
- wp_enqueue_media() Will not load JS on the theme
- How do I get allowed Media Library upload file extension list?
- Cannot upload .mp3 file to wordpress media
- Restrict WordPress Media Library for a specific user role (users can only see/select own media)
- Display attachments by the ID of the post being edited in the wp.media frame (frontend)
- Uppload image from another source wp.media
- move_uploaded_file() not working on wordpress front end
- WordPress Issue : The uploaded file could not be moved to wp-content/uploads/
- Convert (-) and (escape) signs to (_) when uploading files on wordpress media library automatically
- Using wp_enqueue_media() with switch_to_blog() issue
- How to get the return value of wp.media({ frame: ‘post’ }) in all cases?
- WordPress Media frame pre load images from ids
- Media library only shows for admin. Doesn’t show editor or below [closed]
- upload_max_filesize is set to 64 MB already but WordPress is still showing 2 MB
- PHP error when trying to upload .mp3 files via Media Library [closed]
- A link (not in the post) to download a specific PDF file
- Migrating media files (documents only) to a fresh install and maintaining the same directory structure
- How does wordpress handle media files?
- WordPress media upload issue could not insert attachment into the database
- Thumbnail images missing in WP media library
- How to change the text of the “You are about to permanently delete these items…” alert message when deleting media from the media library?
- Open Media Uploader Link in single post or page
- Remove Media File Items From Server That Do Not Exist in Media Library
- Add SWF file to wordpress through custom template
- What if I have a large file on the server that I want the wp library to have?
- Uploaded images result in a file url with full path on disk appended
- Using WP-CLI “wp media import” to sync files to the media library
- Efficient way to move media folder to another folder
- Make inline uploader (plupload) on options page upload to a specific folder
- Images not displaying on site or media library
- Replicate Media Galley Edit view in Add Media View
- Front-End Upload media with category
- How to manually set an attachment in a post?
- Media Library: Remove replace images of selected author
- Adding attachment custom field metadata to TinyMCE tag
- How to upload multiple images using WP rest API to media?
- Media not displaying other users uploads – WordPress 4.9.2
- Organizing the Media Library for Cleanup
- Issues with WordPress 3.9.6 media libraries on XAMPP
- Insert media while posting is not working with new wordpress update
- controlling whether upload is attached to post or not
- How to split my uploaded media into directories?
- wordpress 3.6 media manager cropping timestamp
- Image in binary in the data to WordPress media library
- How to get attachment id as soon as it is uploaded through media uploader in jquery?
- How to restrict images in v3.5 Media Library modal to only those from a specific post id?
- How to hide media uploads by other users in the Media menu?
- Multisite, upload images directly to Amazon S3
- Force wordpress to see uploads folder media
- Disable TinyMCE Drag and Drop
- Setting wp_temp_dir and permissions not working for “Missing A Temporary Folder” error
- Media handle sideload not working
- How to overwrite wp_unique_filename logic
- How to change upload directory based on frontend form input name or ID?
- WordPress suddenly starts uploading media to an old (backdated) folder
- Stop WordPress from generating redundant image size
- Upload featured image from front end using media-upload.php
- Get File Object from wp.Uploader
- Redirect to another page using contact form 7? [closed]
- Set different max upload size limits based on file type/extension
- Correctly using the root directory for media uploads?
- limit media upload to once a day
- MIME types not recognized by media library
- How to Protect Uploads, if User is not Logged In?
- Bulk upload images in upload folder does not show in media library
- Is there some way to find if media items are used anywhere on the site?
- WP_Custom_Media_Control | Give ID to media file
- WP Add Media Button – Can I set the default size to Original/Full Size
- All files unattached in Media Library
- WordPress media upload multiple images
- Is there a way to force Featured image to show as attachement?
- Updating Media Library PDF’s in bulk
- Assign multiple categories to Media Library upload
- upload image to wordpress media library failed for custom post type