The answer was as stupid as simple: I wrapped the init
for the class in a ! is_admin()
call. This successfully prevented the callback from beeing fired.
Rule for AJAX loading
- Load it in public
- Don’t hide it behind a
! is_admin()
call.
The 2nd line from admin-ajax.php
define( 'WP_ADMIN', true );
Related Posts:
- Ajax takes 10x as long as it should/could
- redirect out of wp-admin, without losing admin-ajax.php
- How to call a PHP function with Ajax when the user clicks a button
- Ajax for non-logged-in users
- Is there any way of of making an admin-ajax request without the use of die()?
- Ajax request returning full page code
- How do I send an ajax request and get a response back from a function?
- How to implement AJAX post navigation into WordPress?
- wp_ajax_[service] returning 0
- Trying to load content of a post via AJAX
- Insert Post using Ajax
- How can I automatically login using a URL?
- Ajax function returns -1
- Problems with creating sortable sections in customizer
- Is it OK to use a system cron to trigger a function hooked into the AJAX API
- Filter WP user acf field by ajax
- Ajax Request not coming back to class
- How to make ajax content indexable by search engines?
- Ajax requests with different WordPress Address and Site Address setup
- Conditional action hooks
- AJAX requests broken due to HTTPS for wp-admin
- query vars in url work but not in ajax call
- is_home doesn’t affect content
- Is it safe to use $_POST directly in my plugin instead of using admin-ajax.php to receive data from ajax?
- How to make get_theme_mod work with AJAX in the customizer preview
- How to declare a JS variable in an AJAX call
- is_page() conditional not working inside an AJAX function
- jQuery Ajax passing empty parameters to my function?
- Fatal error: Call to undefined function get_post() with ajax
- Convert this relative path to absolute
- how to send Ajax request in wordpress backend
- admin-ajax.php slow website, how to fix
- WP Admin AJAX Security – using POST to include a relative URL
- wp_create_nonce() in REST API makes user->ID zero
- ajax nonce verification failing
- Plugin: AJAX query external API to sync to tables
- admin-ajax.php ” Missing argument 2″ warning
- Update get_pages using ajax on form select change
- splitting the URL using jQuery
- How do I get reusable blocks via frontend REST API?
- Is there builtin way to use protected AJAX endpoint?
- How to create an ajax endpoint without js?
- WP Ajax never returning any data / calling action
- Refresh Markercluster after ajax call
- How to load content from many posts on a page, only if needed
- Making an ajax request from a different domain
- Mapping Backbone Models to serialized array in wp_options table
- WordPress Settings api data not sanitized if i use ajax
- Pagination Using ajax
- wp_ajax_ works fine but wp_ajax_nopriv_ returns HTML and not calling function
- Why is wp_localize_script returning false?
- Ajax call with javascript in post content (not enqueued)
- Change header.php after ajax call
- What’s the latest I can hook into wp_ajax_%?
- Nonce doesn’t validate in nopriv call
- WordPress – admin-ajax.php returns 502 Bad Gateway [closed]
- Using admin-ajax prevents regular php form submission
- How to use ajax to get multiple outputs?
- Change URL without reload Ajax
- Admin-ajax.php 400 error in custom theme
- Why does check_ajax_referer give a 403 error on https websites?
- WordPress is creating nonce as a logged in user but verifying it incorrectly
- Hide Load more Ajax button if there is no more users to load or less than the number?
- ajax refresh to display new posts
- How to get setting from separate file?
- wp_ajax action is not run when ajax trigger
- Contact form – ajax, wp_mail
- Replace link with form to pass variables to javascript / ajax
- admin-ajax.php calls fail if referrer is sent with 500
- AJAX not working when clicking load more button, when two terms are present in tax_query
- Can I use application/json content type in WordPress
- AJAX – get_posts for a specific post type returns empty
- Admin Ajax always return 0
- Ajax call undefined index
- Is there a hook that fires after an ajax call?
- Dynamic Twitter card images
- How to pass value from ajax to php in no conflict mode?
- What is the relationship between UFW (firewall) being enabled and cron job running?
- error_log() not working within wp_ajax_{action} handler
- Is there a way to add ajax hooks without editing the functions.php file?
- Implement AJAX to fetch pages or posts content in a WordPress custom theme
- Ajax a php file that has Advanced Custom Fields in it
- AJAX is not submitting data to database
- Ajax show custom post data form & script
- about load more ajax
- How to use add_action(‘wp_ajax_[action name]’,…) for a specific page with condition?
- Using AJAX to load div doesn’t always work
- Turn a URL into content preview
- AJAX save options inside class
- Deploy Subcategories with Ajax not working
- Allow guest to update custom post met using ajax
- Simulate a specific page when making AJAX calls
- How to load post_meta for custom post type via Ajax
- Load more posts with Ajax and masonry
- Caching for logged in user and Ajax update
- update_user_meta updates to a wrong ID
- Disable Ajax for Spiders
- WooCommerce AJAX cross domain add to cart
- AJAX function needed (toggle text) [closed]
- Call pre_get_posts inside ajax