I have made a plugin that uses the Media Library to allow users to upload files to a specific directory – using the upload_dir
filter.
I would like to know if there is a way (i.e. a filter) I can use to limit the media library to displaying only files contained within my custom folder?
If possible, I want the user to be able to choose only files that have been uploaded to the custom folder when interacting with the Media Library instantiated by my plugin.
A solution that works for me is to add a clause to the WordPress query when the media library is being displayed.
From browsing my WordPress database I noticed that the full path to
wp_posts.post_type = 'attachment'
is stored in thewp_posts.guid
column.