Typically, people do ajax calls like:
add_action( 'wp_ajax_ACTIONNAME', [$this, 'callback_Function'] );
However, I am interested, what are key differences (other than having authorization checks & wp_ajax_nopriv_
) from doing the AJAX $_POST
checks within:
add_action( 'init', [$this, 'callback_Function'], 1 ); // I know, priority with 10 might make it slower
public function callback_Function()
{
if(!empty($_POST['action']=="ACTIONNAME"))
....
}
my main interest here is if there is any significant speed/performance difference?