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
- Send POST data using XMLHttpRequest
- how to add version of style.css in wordpress
- What is the role and history of the $content_width global variable?
- Override parent theme translation on child theme
- What does exactly GPL license mean for my WordPress theme?
- How to set thumbnail image for a (child) theme
- Categorising themes by folders in backend
- Add a page outside of the current theme?
- How to create a live demo page for a theme? [closed]
- How to incorporate admin theme in my back-end-plugin
- Is it possible to stop a theme activation when a certain plugin is not activated
- add image size still doesn’t work even after regenerating thumbnails
- Using chunk theme from wordpress.com on my own host
- What is the first file wordpress looks at in a theme?
- Duplicate and change a Theme Widget
- Custom Upload Panel in Menu Bar
- Best location for theme translation files
- Two Navigation Menus in Themes Produce the same menus?
- WordPress themes under GPL license
- How can I customize the search results in Bones theme?
- How to develop a theme while having another show up
- POST from jQuery to PHP
- When does WordPress wrap inline scripts in CDATA?
- Theme not showing after uploading
- Being asked to update a theme that I don’t have
- I want to run different WordPress websites under the same database
- get_template_directory_uri does not seem to work when defining WP_CONTENT_DIR
- Using a _GET gives me a debug error (over my head)
- Switch to other theme at URL
- How to go about pre generating css file with variables from theme options
- How to load a different theme for categories?
- How can I create an “excerpt” with text that won’t be displayed in the post itself?
- Possible to put header-{your_custom_template}.php in subdirectory?
- Why wp_enqueue_style() not working?
- How to remove header image on subpages in Twenty Eleven (default theme)?
- Can I update themes without enabling maintenance mode?
- How to change sidebar per page?
- 404 Error while accessing the font files
- Add a series of checkboxes to theme options
- WordPress Theme Development Seemingly Awful Partitioning of Includes?
- jQuery Ajax passing empty parameters to my function?
- Child Style.css not overriding parent theme style located in assets/css/main.css
- Disable Theme API / Front end (for API only environment)
- Hide default “Recent Comments” Widget if there are no comments yet
- Creating a theme options page
- Showing post thumbnail (attachment) on the archive.php category listing
- OptimizePress Theme Overriding add_filter page_template
- Theme Check warning wrong direcory for theme
- Static page not working
- How do I change the scan depth for page template files?
- Moving test theme to live site without mySQL error – how? [closed]
- Add more widget areas to a theme
- Posts and Pages not showing on admin, but showing in theme
- Error defining a gutenberg block in a theme
- Apache errors when retrieving taxonomies
- How can I add class to every quote element?
- Looking for a fully customisable WP responsive theme to develop a small scale fiverr type site for voice artists [closed]
- Page dissapears when i click save
- wp_get_theme() works fine, but wp_get_themes() returns empty array
- Ajax fail and get 504 error
- Read More Button Not Responding To Click
- How to use command lines an activate theme in wp – cli also setup Vagrant/Sage Theme?
- Can’t resize logo in responsive theme?
- Show success or error messages in Ajax response to WordPress custom registration form
- How to change the format of posts on the hompage?
- WordPress without a theme – help!
- Configure new installed WordPress in live server
- Where does WordPress get the theme name from to check for updates?
- Hi everybody, I have a problem of search box
- Updating WordPress Theme Files
- Multiple sub directories for theme template pages
- My blog suddenly can’t find my stylesheet?
- How to submit the date with ajax?
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- How to use my .mo file in the Divi child theme instead of file in a parent /builder directory?
- How to fix Gutenberg with SiteOrigin page builder deleting content when editing
- How to allow users to switch to the child theme from front end without plugin?
- How to remove the option data of a theme when that theme is removed?
- Convert theme to be based on Bootstrap?
- ajax form function error
- Include root files into header files
- Static posts page is not working
- Cannot use some themes within Managed WordPress of Go Daddy [closed]
- How to track your theme usage on the internet?
- How to add Company Logo to Chosen Theme
- What security risk is not having “default” theme?
- Remove image next to header image on WellExpo theme [closed]
- WordPress site is not loading properly ( showing a min-page)