At some point between muplugins_loaded
and shutdown
wp_ajax_*
,
wp_ajax_nopriv_*
are executed, but where/when exactly?
I have found that this is working:
add_action( 'wp_ajax_actionname', 'callbackname');
add_action( 'wp_ajax_nopriv_actionname', 'callbackname);
as well as:
add_action('wp_loaded', function(){
add_action( 'wp_ajax_actionname', 'callbackname');
add_action( 'wp_ajax_nopriv_actionname', 'callbackname);
});
So it is after wp_loaded, but when exactly?
This isn't pure curiosity, the alternative wording of this question would be "can we safely assume that wp_ajax hooks aren't executed when Wordpress loading, including it's plugins, is incomplete"?