I guess, that whitelisting the endpoint is not possible, as this is the simplest solution here.
It will be a little workaround here, but you can try to replace your AJAX endpoint, with a REST API endpoint.
Your main upload logic should stay the same, request will be similar. Maybe you can even use the default WordPress endpoint:
https://developer.wordpress.org/rest-api/reference/media/
If no, just register your own endpoint:
https://developer.wordpress.org/reference/functions/register_rest_route/
Related Posts:
- Adding admin-ajax.php to the frontend. Good or bad idea?
- How to get Ajax into a theme – without writing a plugin?
- WordPress AJAX in header.php
- Varying Search Result Pages
- Create register form without a plugin
- Search form not finding content in template page
- Knowing blog name using blog id
- WordPress ajax insert and delete if already inserted delete the post id stored in custom table
- Simple filter to change label name of Email Adress to something else
- Adding admin-ajax.php to the frontend. Good or bad idea?
- WordPress Form To Email.php and Theme
- Theme making direct ajax calls to theme folder
- How can I allow the Editor Role to change Theme Settings?
- How to Link External jQuery/Javascript files with WordPress
- Undefined offset: 0 in > […] /wp-includes/capabilities.php on line 1067
- Best practices for a Style/CSS based theme options page?
- How to license my commercial WordPress theme? [closed]
- How to Use WordPress as Static CMS Without Blog Posts
- How do I create my own admin button and theme settings page?
- ajax – why multiple calls to wp_create_nonce() return same value?
- Editing Links in the Footer of WordPress Themes with Base64 Encrypted Code?
- How to set two different themes on one WordPress? (Desktop vs. Mobile)
- How can I add a set featured image function to a theme that doesn’t already have it built in?
- Jquery in Child Theme
- Changing the visible url path to css & js files
- Display custom_background outside wp_head()
- Using AJAX in a plugin to submit form – REALLY confused
- Retaining old HTML archives and displaying themes conditionally
- Front End Post Submit Form
- Theme Activation, Create Database Tables
- Can we create a child theme for a premium child theme built on Genesis framework?
- WordPress ignoring specified template for front page. Why?
- WordPress theme ajax have_posts()
- Alternate header image
- How to start learning CSS and theme development?
- How do I make the category template display full posts instead of partial posts?
- Does uninstalling a WordPress theme delete its database values?
- PHP Parse error: syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) on line 230 [closed]
- Child theme not using parent theme css/styles/formatting?
- Problem after renaming wordpress template file
- 100% width Featured Image Size
- Make it possible to pick a color theme for specific pages
- wp_add_inline_style() not working?
- X-Axis of Site is Messed Up Because it is in Hebrew
- How to create my own sidebar in Twenty Eleven child theme?
- How to find out if page_for_posts is showing (in order to style menu item)
- Create custom HTML/JS app inside page
- WP can’t create new directory
- style.css not reflecting changes. I have no cache installed
- the_content() is not displaying content, why? [closed]
- Permissions for installing themes and files in general?
- Frameworks for Premium Theming [duplicate]
- Remove problem PHP code entered into footer via Theme
- Twenty Seventeen search error
- Protect shortcodes, custom JS, and CSS from theme updates
- Recommended Media Size for Twenty Fourteen
- Free WordPress theme for an intranet tutorial site [closed]
- How do you remove a broken theme from WordPress Admin (without FTP or Cpanel)
- Using Grunt and keeping theme comments
- How to stop being directed to admin.php after sending request to admin-ajax.php
- Why are so many popular responsive WordPress themes “boxed” at 940px? [closed]
- Theme Modified By Updates
- I want to develop a theme using WordPress. Which theme should I start from or develop from scratch? [closed]
- Background image appears on localhost site but not online
- Pages and posts on ElegantTheme featured slider [closed]
- Error when installing theme – “failed to open stream: No such file or directory in…”
- disable default widgets in Responsive theme
- Theme seems to have different options on wordpress.com and own-server install
- Blackberry mobile theme redirection
- Child theme breaks after update of master theme
- Insert the current theme header into an external HTML/XHTML file
- How to use one git (github) repository for version control for multiple themes
- I’ve got a theme I can’t update and won’t let go
- Make theme settings support multisite enabled (WordPress Mu) site
- Is there any way to modify images from a theme using the web interface?
- brand section in wordpress lost after change theme
- Ajax Call not Working in Plugin
- how to get json file in wordpress template
- sidebar in 2020 theme as a widget
- Remove the breadcrums on a theme W
- Tinymce button is not visible for a theme
- Serve resources from a consistent URL GT Metrix
- WordPress loads old style.css, then loads current one
- Full width background slider
- Ajax contact form returnig 0
- the_content doesn’t return tags
- Change the main width of Twenty Thirteen theme
- Meta title W3C Validation Error with
- Can I add a blog subfolder to my website and use a different theme
- How to modify/ customise NextGen Gallery’s templates? [closed]
- Overwrite template-tags.php in child theme
- How to know which theme are we using in wordpress and change the content as well? [closed]
- Basic clothing showroom [closed]
- Custom WordPress Does Not Display Anything But Background in IE [closed]
- Two types of layout in woocommerce SHOP page [closed]
- How to include a new file in theme
- Theme install failed
- My theme switches to “Twenty twenty two” on its own even if deleted
- Check if style is declared in child theme from within parent theme. if so, use that style in parent theme
- Homepage not loading correctly, only after refreshing