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
- 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)
- Changing upload directory for plugin uploads only
- 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
- Automatically determine minimum WordPress version required for a plugin?
- Create a custom admin page for custom post type + taxonomies + metas
- Is There A Hook To Process The Content Of The Text Widget?
- Preferred way to include Advanced Custom Fields in a plugin?
- I can’t find where a hook is being defined in a plugin – Easy Digital Downloads
- Replacing WordPress menu functionality with a plugin
- Database for development
- How to create multiple Gutenberg blocks in one plugin
- How to disable reCaptcha v3 except on Contact Form 7 pages?
- Fetching the value of forms in WordPress AJAX
- Get Current Menu Location inside Nav_Walker
- Append country to ‘pretty’ url but serve same page
- Where to add hooks in a class
- Insert terms for custom taxonomy on plugin activation, or each page load (init hook)
- Adding a brand column to WooCommerce Products
- Custom GET Parameters In Plugin’s Admin Page
- Adding option to Gallery shortcode
- WordPress Search filter to remove possible script injections
- Plugin that saves form data
- how to invoke wordpress API from other existing PHP system
- Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
- jquery & ajax sending data to php
- Replace first occurence of a word with link [closed]
- Converting core modification to a plugin
- Adding filter to the title without affecting the menu title
- How to show multiple instances of the WP125 Widget?
- Multiple TinyMCE on button click is initialized and appended but why only last one is writeable?
- How to create a custom post-new.php page for plugin , no wp menu
- Where to add functions and code snippets in wordpress
- How to re-render inspector controls?
- Shortcode content is not showing. Only the [shortcode-tag] is showing
- How to remove the WooCommerce Product->Category thumbnail from admin [closed]
- Plugin Development – Call to undefined function comment_exists()
- Replace “content-area” of themes 404 page with plugin?
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- WordPress doesn’t create table on plugin activation
- Custom signature appears twice on page
- wp_mail links are dead
- Adding Third Post Box Column: postbox-container-3
- Find Any Theme’s page.php File
- WP Job Manager – Show recent jobs as cards
- Admin Menu for New Post