I am trying to add a unique custom tab to the Media Uploader using this code.
var customMedia = wp.media({
state: 'customState',
states: [
new wp.media.controller.Library({
id: 'customState',
title: 'Library',
library: wp.media.query({
type: 'image',
category: 'icon' // adding a filter to ajax_query_attachments_args
}),
multiple: false,
date: false,
})
]
});
So far it shows up the Media modal with the images in there as I expected. The issue is when I upload a file by drag and drop it won't appear on the list of attachments view when the upload finishes, although it does upload the file. And it appears when the page is refreshed. https://share.getcloudapp.com/xQuY8gQW
I added one more state but without the 'category' in the query and when I do drag and drop, the image uploads as usual but it appears on the second tab.
Is there anything else I am missing? I tried reading the code for the options that the library receives and couldn't figure it out.