This is a bit out of context but I think you can approach it a little bit differently, you can limit access to default media library for roles below “admin” or “editor” depending on your setup. For instance you can block authors from uploading files to media library using the following code..
if ( current_user_can('author') && current_user_can('upload_files') )
add_action('admin_init', 'remove_author_uploads');
function remove_author_uploads() {
$author = get_role('author');
$author->remove_cap('upload_files');
}
Then allow them to upload to media library from a front-end page on the site. Here is a good reference to that How can I add an image upload field directly to a custom write panel?
Related Posts:
- How to re-arrange media uploaded using : media_handle_upload() as per year / month
- WordPress media uploader – upload tabs not hiding
- Can’t upload format files on media library
- Custom Link In WordPress Media “Attachment Details” Upload Screen
- How can I add a Description column to the media library browser screen?
- Upload files in wordpress
- Rename UPLOADS folder with custom WP_CONTENT_DIR
- Decrease file size upload in Media
- Remote upload file to server B
- Using Images in WordPress – Best Practices
- How to move wp-content (or uploads) outside of the WordPress directory
- Limit Media Library to Given Folder
- Set a maximum upload count for users on a specific user role
- How to make custom bulk actions work on the media/upload page?
- Is there a plugin to make attaching images easier?
- Automatically wrap post image in div
- media_handle_upload weird thing
- Looking to display non-image files in Gallery with logo specific to file type
- where can i add custom script to stop header video from autoplay
- Retrieving and Storing Images Linked from Other Domains on Local Server?
- How do I go straight to “Edit More Details” when clicking on an item in the media library?
- What’s the best “insert all images” plugin?
- Syncing Avatars across multisite
- How to stop unlink images when remove a site or user
- Hide upload image fields for the different media upload popups
- How to retrieve alt attribute for an attachment (uploaded image)?
- Customizing default Mediaelement player
- How to insert a sitemap within a subsite when using WordPress multisite
- Add a InfoBox in the media upload window
- I’m using add_meta_box() but want to include TinyMCE editor *and* Media Uploads for each box
- Get Image from Media Library with the Title
- wp_generate_attachment_metadata is creating an empty array
- custom upload directory only for plugin uploads
- problem in uploading attachment to custom directory
- Installing new theme on running site
- Media Upload not working after hiding some elements from functions.php
- Personalized Gallery what are my options?
- the temporary save folder is wrong
- wp_delete_attachment doesn’t delete image files / doesn’t work
- Altered Media Library URLs
- How do I enable the text editer in my WordPress theme? [closed]
- Limit attachment caption characters
- Organizing the Media Library for Cleanup
- Customizing the built-in Media Playlist
- Custom image sizes ignored in WP 3.5
- WordPress uploads directory. Featured Images storage
- Can’t upload files 1MB+ [closed]
- Custom Search on media files PDF images pages posts
- How can I get the Media Library backend to show larger thumbnails?
- Multiple Inputs in a Customizer Control
- Embedding a SOAP Client into a WordPress Plugin?
- Why do I get the timeout warning?
- Remove WordPress theme from a specific page
- Verify nonce in REST API?
- How to hide media uploads by other users in the Media menu?
- Add custom html to last sub-menu item
- How to keep a WordPress site synchronized between two servers?
- Multisite, upload images directly to Amazon S3
- Force wordpress to see uploads folder media
- Automatic image renaming based on title
- Manipulating post meta in the customizer
- Disable TinyMCE Drag and Drop
- Rearrange elements outputted by comment_form()
- How to build custom WP admin with custom URLs
- Custom editor field displaying HTML in Visual editor
- generate unique number when registering a user
- Upload images with comment
- Php custom query function assistance
- Setting wp_temp_dir and permissions not working for “Missing A Temporary Folder” error
- How can I manage my multiple wordpress websites from main website?
- How to set default values for options page
- How do I deque the default stylesheet?
- How to import custom data via XML, CSV, etc
- Widget Javascript code (ajax)
- How to overwrite wp_unique_filename logic
- How to change upload directory based on frontend form input name or ID?
- Set Image width=’x%’ (percentage width not pixel width) when inserted via the media manager?
- Why would switch_to_blog stop working?
- Login form in popup
- Replace “WordPress” word in title of Dashboard
- Cannot upload .mp3 file to wordpress media
- How to remove query string from static resource in WordPress?
- Modify a theme to insert custom widgets?
- WordPress custom login page
- Fatal error: Call to a member function add_rewrite_tag() on a non-object in /wp-includes/taxonomy.php on line 333
- How do you modify the WordPress directory structure?
- Change WooCommerce product price based on category and GEO IP country
- How can I defer these JS files?
- Change login error messages? Cookie error message
- Gallery IDS and Captions: hide/show on a per ID basis
- Allow non-admins to access the Customize theme page
- Query post for ‘selected category’ in archive.php
- Multiple Images/ Slider with custom post [single.php] [closed]
- Can I change the URL of a video, or upload a video to a specific URL?
- Using wp_enqueue_media() with switch_to_blog() issue
- Add Custom API Call to WP-Login.php
- Choose sidebars column in widgets.php page [closed]
- Unable to sanitize in customizer and escape in theme without removing ability for user to use “< br >” to insert a line break
- How to apply filters if editing specific template
- How to use standalone Gutenberg (block editor) instance on any my own admin page in WordPress