Lightweight admin-ajax.php
replacement for WordPress that can be added to any theme.
Adds wp_custom_ajax_
and wp_custom_ajax_nopriv_
hooks that work like the wp_ajax
and wp_ajax_nopriv_
hooks.
The file is set up for placement inside your theme's directory, but you can define the location of the wp-load.php
file by changing the $wp_load
variable.
Change the URL in any AJAX calls from your admin-ajax URL to the URL for the wp-ajax-custom.php file.
Note: You can make an even more lightweight version of this file that only loads in the specific portions of WordPress that you will need for a particular action, but this is meant to be a general ajax replacement that is more lightweight and runs faster than the standard admin-ajax.