There are only three explanations for why this isn’t working:
First, something could be unregistering your action. That doesn’t seem very likely, though.
Second, your code never runs in the ajax initialization.
Third, the wp_ajax_my_function_call
hook never runs.
I wouldn’t worry about the possibility of the first.
As far as the second, just make sure your code is run before wp_loaded
, as anything after that (i.e. template_redirect
, wp
, pre_get_posts
) isn’t run in an ajax load.
For the third, just make sure you’re posting your ajax request to wp-admin/admin-ajax.php.
Also, if you haven’t already, I’d suggest giving a quick read to admin-ajax.php and wp-settings.php.
Related Posts:
- Using Ajax with a Class file
- Are ‘wp_ajax’ and ‘wp_ajax_nopriv’ exclusive to authenticated and non-authenticated users?
- How to modify wp_ajax function?
- Ajax Request not coming back to class
- wp_ajax action is not running
- add_action and Ajax
- WordPress Ajax Problems
- Placement of add_action() for ajax callback?
- admin-ajax.php ” Missing argument 2″ warning
- Code run fast on a cronjob but slow with a do_action or ajax call
- WordPress ajax-action how to return content
- WordPress action – Pass arguments into action in an AJAX call?
- why does not work ajax that add_action registered in wordpress
- wp_ajax action is not run when ajax trigger
- Sharing variables in both actions wp_footer and wp_ajax
- Ajax callback not work
- admin-ajax.php calls fail if referrer is sent with 500
- How to run an ajax call in elementor editor
- do_action won’t work in ajax callback
- Ajax call works for logged in users and returns “Bad Request” for guests [duplicate]
- Its possible to ajax update the content of the admin custom post type list
- Trigger action via button
- Why function called by admin-ajax executes synchronously?
- where does my function output from load-* go?
- Static var overwritten with WP AJAX action, works fine without AJAX
- Ajax in a settings page (update_option is undefined)
- gettext does not translate when called in ajax
- Execute one AJAX request after another AJAX request finished
- Ajax and autocomplete
- admin-ajax.php vs Custom Page Template for Ajax Requests
- Load tinyMCE / wp_editor() via AJAX [duplicate]
- How to correctly load wordpress in a non WP script for AJAX request
- Why is admin ajax reloading my page
- Plupload in metabox – AJAX action not working in Class
- CPU usage: AJAX and Heartbeat API on admin pages
- Confused on AJAX submit form through page template
- AJAX action not triggering PHP function
- Ajaxing in functions.php
- Enqueue script dinamically
- Most performant way of fetching remote API data?
- Admin-ajax responds with 0 due to empty $_REQUEST
- Help with AJAX front end comment moderation
- Enqueue script in header
- wp_ajax_nopriv_xxx is not firing on one site, works on all others. -1 for logged out users
- Ajax Modal Flickers When Opened Multiple Times
- Increased CPU load due to admin-ajax.php spam
- Ajax image upload with media_handle_upload and form.js
- Can’t get result from sql using ajax result
- Theme Customizer – Conditional Controls
- Edit a different page in WP Customizer
- WordPress AJAX – how to return true or false in the callback function
- WordPress Ajax POST Error 403 admin-ajax.php
- Ajax post returning full html page as response
- Which allowed API hooks work to add wp_ajax action?
- Pass additional parameter with async upload
- Performance optimization of tree like structure
- WordPress search results with Ajax, get_post_type() not working
- Audio TAG Not using MediaElement When Page is loaded through ajax
- Add/remove action on jQuery toggle
- Is it secure to use admin-ajax.php in front?
- Best way to use ajax front-end?
- Ajax calls from the theme directory
- How to pass parameters from jQuery ajax into PHP function?
- ajax is returning 0
- How to add ajax url to js using wp_add_inline_script()?
- use jQuery.load() to include a php file in a div, wp_query() is part of php file
- WP AJAX post filter > do something with empty value
- Redirect after saving form; and yet use wp_die()
- ajaxt returning object object [closed]
- Load more posts (Ajax) in tabbed sidebar on single.php
- Something strange with ajax
- admin-ajax.php returns 0 even when the post status code is 200 OK
- Why is the file not uploading to the server?
- Get localize of a loaded javascript
- Merge PDF files from post custom fields(ACF) into one PDF file and respond back the created PDF file, WordPress(AJAX Request)
- REST public POST giving 403 forbidden nginx
- Query data after an Ajax insert
- How to get next and previous post into ajax formed modal windows?
- Content including hooks inside wp-settings.php are being called twice in WordPress
- Problem when sending file via ajax
- wp_verify_nonce not working on the mobile device
- Can’t GET Variable from AJAX URL
- JS global variable doesn’t update
- 404 error custom post type rest api
- How to update cart total after AJAX success
- Change button text after ajax db update
- Jquery wrap permalink in a data-attribute?
- How do I display posts of a specific day?
- Load .php file into div using ajax
- Native WordPress Video Shortcode Not Working After Post is Loaded via Ajax
- Ajax Function call is always returning 0 in front end(without plugin) [closed]
- Using AJAX for dynamic settings pages
- Speeding up admin-ajax.php
- admin ajax is not working for non logged in users
- wp_localize_script not create variable in head section
- AJAX admin Internal 500 error Failed to Upload
- Class property not visible inside ajax callback function?
- Front-end ajax problem all users and guests getting a 302 redirect when accessing wp-admin/admin-ajax.php
- Use Ajax to get an Options Settings Value
- How to get variable from other function inside class function using add_action for Ajax call