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
- Why not register shortcodes if is_admin dashboard?
- How to increase the file size limit for media uploads?
- WordPress AJAX File Upload – FrontEnd
- Add inline uploader to plugin option page
- Can I use the wp media uploader for my own plugin?
- Upload specific images to specific folder
- Multiple ajax nonce requests
- How to call WP3.5 Media Library manager?
- How to properly use wp.ajax.post?
- Failed media upload: “The uploaded file was only partially uploaded.”
- AJAX vs Fragment Caching for W3 Total Cache [closed]
- How to make WordPress use protocol indepentent upload files?
- Delete row of custom table in WordPress using AJAX
- jQuery Autocomplete in WordPress
- Add/change multipart_params parameter when uploading post image
- help on wp_editor via ajax load [duplicate]
- WordPress media upload “HTTP error”
- How to change “Publish” button text for specific page
- WordPress function to get term or post object by id
- WP Media uploader loading only once in options page
- Conditional success callback based on Ajax Response not working
- admin-ajax.php slow, how to speed it up?
- I’m getting a 401 while calling the wp-json endpoint via ajax
- problem with WordPress ajax
- Ajax simple experiment
- Out of Memory when Uploading an Image
- How to load new text widgets and polls into the sidebar without reloading the page?
- How to make tabulator ajax call in wordpress?
- Radio buttons live refresh in the customizer
- How to get the last selected media alignment setting?
- Attach media to post by media category
- Admin ajax add tag callback
- Stop auto load wp-admin admin-ajax.php
- Pagination Using ajax
- wp_ajax_ works fine but wp_ajax_nopriv_ returns HTML and not calling function
- Why is wp_localize_script returning false?
- Where to set individual blog quotas?
- Change header.php after ajax call
- File names are being overridden when uploading new media
- Retrieve JSON file from JS trough php
- WordPress – admin-ajax.php returns 502 Bad Gateway [closed]
- Using admin-ajax prevents regular php form submission
- Get featured image with custom size outside WordPress
- ajax refresh to display new posts
- wp ajax execution time aborted 30 sec
- wp_enqueue_media() and upload_mimes problem
- Replace link with form to pass variables to javascript / ajax
- Create multiple folders in upload media folder
- Can I use application/json content type in WordPress
- How to pass value from ajax to php in no conflict mode?
- Upload error on localhost (at minimum, not yet tested online)
- What is the relationship between UFW (firewall) being enabled and cron job running?
- How to change Route respond To A specific Path?
- Hook after all metadata are set is triggering several time
- check_ajax_reffer not working when logged
- Media Library: Remove replace images of selected author
- Ajax show custom post data form & script
- Portfolio list view after clicking back button
- How to upload multiple images using WP rest API to media?
- about load more ajax
- How to use add_action(‘wp_ajax_[action name]’,…) for a specific page with condition?
- Where to store media uploaded by the plugin?
- Organising and display thousands of photos in media library
- AJAX call in backend results in empty update_option
- Ajax Comment: Page reloads whenever the comment submission form is reloaded
- How to fetch meta_value and meta_key in matrix after ajax request by post_id
- Drag and Drop Media Not Working in Windows 10 Edge Browser
- get_comments() returns empty array if called through AJAX
- Upload more than one media files with a post
- Multi site and media uploader
- How to get parent comment’s id?
- Static var overwritten with WP AJAX action, works fine without AJAX
- Can’t upload files 1MB+ [closed]
- Dynamic dependent select box getting null value
- AJAX loading with custom parameters
- Placing ajax actions in different class
- How to update my jquery/PHP function to add/remove user as favorites in (WordPress) users list
- WordPress send Ajax where click button
- Convert base64 string to WordPress attachment uploads multiple images instead of a single one