My first instinct was to find _acfuploader in ACF code to see how they are doing it. Unfortunately the latest version doesn’t seem to have any occurrences of acfuploader.
The second thing I thought of was the wp_get_referer function. You could use it to see where the ajax request came for. Then you could get the post ID from the query string, get the post type and make a decision based on the value you obtained.
However the HTTP referrer can easily be spoofed so you will have to consider the security implications of using it in your code. However, in this scenario the user doesn’t have much to gain from spoofing HTTP referrer so I think it is a viable solution.
Related Posts:
- How to disable drag-and-drop upload function in Media Library?
- Cannot add multiple single images at once
- wp_enqueue_media problem
- Load minimum WordPress environment
- Saving data-URI to media library
- admin-ajax.php returns 0. How do I debug it and fix it?
- Retrieving JSON data in ajax request from media uploader
- AJAX action not triggering PHP function
- How to allow to user non logged in WP system upload in media library?
- Using wp_handle_upload and media_handle_sideload with ajax
- How to know what page is calling admin-ajax.php?
- How to set post_id to 0 when you upload image via Add media button. (async-upload.php)
- Ajax image upload with media_handle_upload and form.js
- wp_handle_upload returns empty error array
- Create a new post using rest api and save featured image using an external image url
- Pass additional parameter with async upload
- While Ajax is working well, media upload isn’t showing the imagines
- Distinguish between 2 instances of admin-ajax.php
- Why is the file not uploading to the server?
- Frontend AJAX Media Upload returning 404
- How to require files in a custom endpoint
- Removing custom physical folders with rmdir
- PHP “php://input” vs $_POST
- Google Maps API throws “Uncaught ReferenceError: google is not defined” only when using AJAX
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- How to solve the error “SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.” in IE
- Show spinner GIF during an $http request in AngularJS?
- Refresh HTML Page in Browser Automatically on Timer – Every 15 Min
- JavaScript implementation of Gzip
- jQuery: Performing synchronous AJAX requests
- ASP.NET MVC controller actions that return JSON or partial html
- jQuery’s .on() method combined with the submit event
- How to Protect Uploads, if User is not Logged In?
- Ajax takes 10x as long as it should/could
- How to check if I am in admin-ajax.php?
- How to Fix HTTP Error When Uploading Images?
- Best way to end WordPress ajax request and why?
- How to load wp_editor() through AJAX/jQuery
- How to add new tab to media upload manager with custom set of images?
- Add “upload media” button in meta box field
- Extend Media Library
- How Can I Add the “Insert From URL” Tab to a Custom 3.5 Media Uploader?
- How to make “Upload files”selected by default in Insert Media?
- WordPress 3.5: Setting custom “full URL path to files” in the Media Library?
- How to cache json with wp-super cache
- Why use wp_send_json() over echo json_encode()?
- “Add Media” button in custom plugin
- Why use admin-ajax.php and how does it work?
- Upload images to remote server
- How to get a unique nonce for each Ajax request?
- what happens to existing media files when I switch to year/month directory structure format?
- Reject upload of wrong-sized images using the Media Uploader
- Open a Thickbox with content trough AJAX
- Initialize TinyMCE editor / visual editor after AJAX insert
- How to show all available images in WP’s media library when using the Polylang plugin?
- Why not register shortcodes if is_admin dashboard?
- WordPress AJAX with Axios
- Permission to edit media files (photo captions, alt tags)
- Xhr.send : PDF upload failed with status 400 and response 0
- How to use AJAX in wordpress front end?
- How to make Contact Form 7 work when injected via AJAX in WordPress?
- How do i set up ajax nonce
- wp_remote_post to admin-ajax.php isn’t sending body value
- How to upload multiple images to use as gallery in Kirki Framework
- Separating HTML and PHP from the Script?
- How allow only the uploading user access to media
- I’m trying to register with AJAX
- WordPress send Ajax where click button
- How to solve too many files in uploads folder(s)?
- wordpress filter for searching categories with ajax not working
- contact form 7 form not working in admin panel
- admin-ajax.php won’t load without logging as admin- JSON Parse error: Unexpected EOF
- add_post_meta not working within AJAX function
- How do I display a PDF thumbnail as a link to the PDF without uploading the image
- wp.media multiple selection limit
- Front end form with images and media_handle_upload logic?
- admin-ajax.php 400 (Bad Request) what am I doing wrong?
- How does the security of admin_ajax.php work?
- wp-content/uploads/year/month returns 404
- Object name undefined using localize script
- Catch Form value at AJAX Form submit
- nonce_user_logged_out to assign guests unique nonces breaks ajax calls
- Nonce verification problem when logging in after a logout
- Help with jquery/ajax requests
- How to revert the media structure from /uploads/year/month to the /uploads directory in wordpress?
- Convert base64 string to WordPress attachment uploads multiple images instead of a single one
- How can I get all attachments by a user on a WP multisite network?
- Problem with “is_user_logged_in()” and woocommerce (Code for custom media upload for each author.)
- Featured Image add tab
- Getting featured image from WP_Query
- register_rest_route to send via ajax as guest results to 403
- Clicking “Show More Comments” loads the same visible comments [closed]
- Multimedia upload error in my wordpress job board plugin
- Uploading media from non-local host computer
- No full page reload when navigating from page A to page B: is this possible with WordPress?
- How can I with implement ajax based numbered pagination to posts which are displayed via ajax?
- admin-ajax issue(internal error 500) in the core and plugins functionality
- Ajax More Load More Button Not Working
- Is AJAX relevant when inserting a new post programmatically?