The main issue I was having is that when an ajax request hits not all hooks are being loaded.
I used this code:
$return = array();
foreach( $GLOBALS['wp_actions'] as $action => $count )
{
$return["message"] .= $action . ", ";
}
wp_send_json($return);
This showed me the hooks that were running before and I got it to work.
I think removing ajax actions on “wp_loaded” is probably best as it seems to be the last hook before admin ajax is hit. If you remove on “admin_init” then you miss the check at the top of the file although that may mean you miss some so maybe it is better to do on admin_init.
Related Posts:
- What’s the preferred method of writing AJAX-enabled plugins?
- How to pass JavaScript variable to PHP in wordpress widget?
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Execute a function using ajax
- Errors while using ajax from external wordpress page
- Built in admin ajax hooks?
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Why is my ajax call refreshing the page?
- Admin-ajax.php is dying “0” without processing function
- how to use ajax to display from database and load more in wordpress plugin
- How to create popup same as wordpress popup feature
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- $wpdb working with ajax but showing ajax error instead of success
- Ajax gives 400 error
- Check if email address exists front end with AJAX in a plugin
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- WooCommerce get_price returning wrong price when used via ajax
- Simple ajax call not working in wordpress plugin
- AJAX search posts and pages
- __callStatic method handler passed to add_action causes bug in PHP
- Using a custom plugin to capture input data via Ajax and PHP
- Ajax contact form widget plugin data not insert in database
- Best place for if/else piece of code related to custom plugin?
- Ajax call returning 0
- Create tabs in admin options page from custom post type loop
- What are the Best Practises When Using AJAX in Plugin Development?
- Admin AJAX doesn’t work in plugin admin page – Even though code is copied verbatim from WordPress Codex
- Submit Form data to another page via Ajax (WordPress Way)
- WordPress front end AJAX. Return 0 :?
- Using WordPress to build membership Page
- Asynchronous request in wordpress
- Is there a better way of handling AJAX requests in WordPress?
- WordPress API functions not working at AJAX functions.php call
- Calling a class method instantiated by ajax call in wordpress [closed]
- Ajax request sends url rather than data
- best way to run a php script away from the template?
- can’t unzip file
- wp_query ‘s’ parameter does not work with WC_AJAX
- wc_get_template_part doesnt display the content [duplicate]
- Error datatable whit ajax
- How to use Datatable with Ajax when creating plugin on WordPress?
- AJAX update fails for public/non-admin users
- WordPress Ajax request “Failed to load resource: the server responded with a status of 400 ()”
- WordPress ajax error 400 bad request for sending data to remote site [duplicate]
- ajax voting for custom post type
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Overwriting Plugin’s Ajax callback function from theme
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- wordpress ajax pagination object value does not change
- How can I use wp_ajax_response for front-end error reporting?
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- WordPress ajax not working in registration
- What’s the preferred method of writing AJAX-enabled plugins?
- Ajax, jQuery and WordPress
- How to get site homepage from plugin?
- Capturing POST data
- Help me with my first very basic plugin
- Load css classes after using ajax calls
- wordpress Ajax success doesn’t return the value
- Jquery post responses 500 error after some time and lastly an 503 error
- Inline AJAX script passing variables to PHP
- wordpress admin-ajax bad request 400
- Show Similar Post Titles ( Similar to Stack Exchange )
- Add content to /wp-admin/plugin-install.php admin screens
- Need a function for changing saved post_date or post_date_gmt to relative time in wordpress
- Activate Plugin which is in subfolder?
- How can I create a simple interface for my WP plugin?
- Where to put my global functions?
- Where does WordPress register default scripts like jQuery?
- Determine Registered Admin Menus
- Help With MySQL to WPDB Query Conversion
- code is working properly in Core PHP but writing coding in WordPress
- Custom plugin init action causing general slowness
- admin-ajax.php warning max input vars exceeded on layered pop plugins [closed]
- How to get the permanent link in a plugin?
- Duplicate results are displayed in a custom plugin [closed]
- Disable Individual Plugins (specifically in Custom Post Types) on a per-post basis?
- AJAX Load more start with x posts
- Basic question about accessing scripts in my plugin
- Loop in elementor custom widget not working
- How to access OOP plugin function inside themes or other plugin
- change or add css to theme from plugin
- Custom Fields for Page Edits
- Is it possible/advisable to set last stable version to previous version?
- How to make sure settings are not lost when plugin is updated?
- Facing Problem with admin-ajax.php URL – Getting 404 with AJAX call
- How to overwrite a plugin?
- jQuery Ajax not loading page with ACF fields
- How can I translate something in my class constructor of my plugin in WordPress?
- Define global variable in theme file and call that variable in plugin file
- Custom Plugin Update
- API Functions to Register and Show WordPress List Tables
- How to save default values into an option and delete those upon actvation and deactivation in wordpress?
- How to Add Jquery FullCalendar in wp plugin in admin
- Why haven’t I see plugins using get_file_data to handle retrieving plugin version?
- WordPress portfolio pagination on home page
- Meta box not displaying on the plugin page
- public custom posts not showing in my wordpress plugin