OK… this turns out to be due to a chunk of code I thought was unrelated. In an effort to keep users out of wp-admin I had added:
function foobar_redirect_admin() {
if( !current_user_can( 'edit_posts' ) ) {
wp_redirect( site_url() );
exit;
}
}
add_action( 'admin_init', 'foobar_redirect_admin' );
And that would redirect non-admin users away from admin-ajax.php
as well as the wp-admin backend which caused the ajax request to fail.
Related Posts:
- PHP “php://input” vs $_POST
- How to solve the error “SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.” in IE
- How to override WP_DEBUG for Ajax responses?
- Call to undefined function add_action()
- Including WordPress in RESTful API
- Registering AJAX callback function that is part of a class without instantiating the class in function.php
- How to tie built in AJAX to an add_action?
- admin-ajax.php vs .load() in WordPress
- Refused to execute script from ‘***’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled
- Ajax form submission from admin panel
- Ajax response is always 0
- Error 400 bad request using admin-ajax.php
- Setting TinyMCE Content in wp_editor
- Ajax is not working for logged out users
- How to use wp_send_json_error?
- Ajax Redirect role = ‘Editor’ to their Dashboard after register
- WordPress AJAX Call Not Return Result
- Form data is empty while posting form through ajax using jquery in WordPress
- load next and previous posts by Ajax and URL update
- How do I check if AJAX nonces are implemented correctly?
- Can I fire an add_action hook inside of a function that recieves data via wp_ajax?
- WordPress Ajax Problems
- How to insert a record by clicking on the link using AJAX
- How can I access the Header of and ajax response from the rest API
- Getting back to ajax search results from a page
- Updating a checkbox value to database for specific row in table
- WordPress ajax success response
- Admin WP List Table Columns Missing
- (updated) How to add AJAX error handling to a (fully) custom registration form?
- wp_handle_upload returns empty error array
- Loading comments in ajax – comment-reply function missing $args
- Woocommerce update product price via AJAX
- How do I query posts by a sub value with the API?
- Popup or admin/update notice on post/page edit screen without page refresh
- Enqueue script in plugin is not working
- Single page site + pushState?
- Interim-Login form on frontend
- Ajax call does not work for this simple code
- WordPress ajax call returns a zero though die()
- Save value from Javascript object to WP user
- wp_update_post onclick button using ajax
- add Additional class to woocommerce cart-contents link
- Ajax insert or update data
- Localize script not working
- Why, if a function accepts arguments, it fails on ajax calls?
- wp_ajax declaration confusing for Front end
- Delete ACF repeater field row on Front End
- No errors in the console but Ajax call doesn’t seem to be working
- Preprocess submitted data
- Update status, meta while inside a post using AJAX button
- How to disable drag-and-drop upload function in Media Library?
- WP_query offset seems to be counting draft post – AJAX load more
- adding ajax load more to display images from meta box
- Can’t load search results with ajax
- wp_ajax is not calling the action
- Deny dashboard access breaks ajax requests
- Run javascript upon successfully set featured image
- update_option in WordPress AJAX
- ajax in admin menu
- admin-ajax.php not loading anymore
- How do you use do_shortcode via AJAX call?
- Auto-suggest to display meta-data, but not to include it upon click
- Loading pages via Ajax and displaying titles
- Ajax Favorite from foreach (how to specify which result result is processed)
- change wordpress pagination url after doing the request
- WordPress responds to the ajax request with readyState 1, 2, 3 before responding with 4
- Filter images from media library by guid meta field
- Counting Posts with multiple taxonomy and terms condition using MySQL and AJAX
- How to send automatic response after form submission without plugin
- Refresh Gutenberg with JS for it show updated post
- How to return a record from a custom table by sending an AJAX request
- 400 Bad Request getting on AJAX Call
- admin-ajax.php 403 errors – no caching, permissions are fine
- React to AJAX adding to the page
- gform_after_submission does not work on ajax enabled form
- How to add Ajax to this Pagination i made?
- Adding user using admin ajax by a user with custom role
- How can I run two AJAX requests simultaneously in WordPress?
- Issue developing an AJAX form with WordPress
- Calendar month navigation in Ajax only working once
- 403 error for ajax POST request
- How modify comments metabox on post edit screen in WordPress?
- my ajax action doesn’t get hit
- Can Ajax Action [add_action(‘wp_ajax_{action_name}’, ‘{action_name}’] be hooked into wp hook
- Strange AJAX problem (SOMETIMES works in Chrome/FF, ALWAYS works in Midori)
- How to check for dependencies for a specific page and enqueue them
- Get Page Type (Category/Tag) Using AJAX
- Ajax Form data is not posted back to the get_results()
- Loads posts of different year via AJAX call
- Data from ajax not updating post meta
- BBPress AJAX problem
- Ajax object comes back empty
- Ajax Slideshow in Post
- WordPress & Ajax
- wordpress ajax always return 0
- WordPress wp_localize_script nonce and ajax URL
- WordPress Ajax – looping data into a table
- how to update pagination after ajax call page 2 show 0
- get_permalink() returns in wrong format via AJAX
- How to add a “Load more” button for the comment section in WordPress?