There must be something identifiable about your form data, such as your input names. Check for one or more of those and process accordingly.
function custom_upload_dir($args) {
if (isset($_POST['something'])) {
$args['path'] = $args['basedir'] . "/mypath" . $args['subdir'];
$args['url'] = $args['baseurl'] . "/mypath" . $args['subdir'];
}
return $args;
}
After some investigation, the only things I see that might help are …
- The post ID is passed through the
POSTdata to the callback.
However I don’t know this would be set to in you custom plugin page. $_SERVER['HTTP_REFERER']appears to be set correctly. You could
parse that to determine if your plugin page is the originating
page.
If I had the full plugin source I could do some testing.
Related Posts:
- How can I add an image upload field directly to a custom write panel?
- Checking if a file is already in the Media Library
- Standard location for plugin to save/cache files?
- Saving data-URI to media library
- Can I use the wp media uploader for my own plugin?
- Change Media Uploader default directory
- Changing upload directory for plugin uploads only
- Upload file to remote storage
- Why are two functions over-riding each other?
- WordPress Media mime type filter problem 4.0
- Using the component outside the editor. select(‘core’) is null
- Proper way to hook wp_get_attachment_url
- Getting Details Of Uploaded Image
- Sharing a common set of image files for media library, across all sites within multisite
- Uploading images from a custom page using blueimp uploader?
- Hook to get image filename when it is uploaded
- How to send email in wordpress with more than one attachments
- Using the default wordpress uploader inside plugin
- Files automatically added
- What filter should I use to insert a button inside on Media>Add New
- Changing upload dir in a plugin regardless of post type
- How to replicate Media Library “Add New” on Plugin Settings Page
- Plugin writing: access file that was just uploaded
- Custom delete option button in plugin settings
- How to enable sorting in custom media uploader in plugin
- Create a new post using rest api and save featured image using an external image url
- Why is the temporary upload always 4.1K
- Upload multiple images and insert them into custom html code
- wp_editor add media button not working
- WordPress Specified file failed upload test
- How to create a digital product download link that can’t be used twice?
- How to submit/upload data to database and in specific folder?
- Cleaning a filename after image sideloading a url that contains `%20`
- Get audio metadata on file upload
- How to move an image in a plugin to the upload directory and make it as a media of wordpress?
- Why doesn’t update_post_meta work for certain strings?
- wp.media Uncaught TypeError: Cannot read properties of undefined (reading ‘state’)
- Insert and read media from the WordPress library and call in the plugin
- Trying to rename a file upload as the hash of file content on wordpress
- Home page is not loading, where in other pages are displaying on the site
- WordPress5.2.3: Better File Download Plugin validation issue
- WordPress discards PNG file when uploading plugin file
- Hook for validating and rejecting frontend image upload
- Changed media upload path for plugin, but generates error & shows wrong url
- How to destroy or dispose wordpress uploder/manager?
- Displaying $_FILES data (simlar to $_POST)
- How do you filter get_media_items by mime type in a custom media upload tab?
- Is it possible to convert various image types from remote URLs to WebP and then serve them immediately?
- upload script in plugin development [duplicate]
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- Upload to a specific media folder created by FileBird Lite
- Load images from CDN and custom features to “Add Media” dialogue
- upload image to wordpress media library failed for custom post type
- wp media uploader and ID3 tags
- WordPress Playground and uploading permission issue
- Do uploaded files to /tmp/ get deleted in WordPress automatically?
- How to modify the uploads directory for wp.media.frame assigning an subfolder name
- WordPress Media Uploader not displaying image that has just been uploaded
- Settings API updated messages won’t show if custom admin page not hooked into add_options_page()
- When wp_schedule_event action has two possible directions, how to avoid an infinite loop?
- The ideal place for storing persistent PHP objects
- Preparing a string in an array for localization
- get_posts / WP_Query Memory size of 134217728 bytes exhausted
- How to Use WordPress Color Picker API in Custom Post Type Metabox
- WP_Error handles errors, but how can I show success with a message?
- How to determine wordpress base path when wordpress core is not loaded
- Calling a function from functions.php in custom page/ blog post
- Does WP Have a Function To Generate .htaccess RewriteCond?
- Changing bloginfo description from a plugin
- Overwrite default XMLRPC function from plugin
- WordPress Plugin Setting’s POST
- How to update total price of completed order in woocommerce? [closed]
- How do I add a custom sublevel menu specified in one directory to a custom top level menu specified in another directory?
- wp_localize_script and host/browser cache
- Get a custom table to an array
- Replacing Scripts in Admin Load_Scripts
- How should I store a log for my plugin
- what is the difference between these phares?
- WP_Query filters
- Plugin Architecture Question: How to avoid using transients
- SSL certificate verify failed
- Can’t upload image using media_sideload_image
- How to load library scripts in admin from plugins in noConflict wrapper?
- Is it necessary to do validation again when retrieving data from database?
- Using WordPress PHP code, how to bulk delete only 100 subscribers at a time from thousands of users?
- term_exists() returning NULL on term that exists
- Insert Into Post Not Working For Audio File Using jQuery
- Enqueue a file that’s not js or css
- What is the replacement for rich_edit_exists()?
- Disable Auto-Expanding Menu in WordPress Admin Menus
- why does get_option( ‘home’ ) not work while using in plugin [closed]
- Undefined is_user_logged_in() error with Plugin Query code
- post content and shortcode content displaying out of order
- How to store sensitive user data (passwords)
- How can we upload file to root directory of wordpress
- Adding External Gmap JS to WordPress
- WordPress Dropdown image select
- Best place to keep files that are called by cron jobs?
- How do I call the dashboard’s sortable javascript in a plugin page?
- Apply Filters Causing a 500 Internal Server Error