admin管理员组

文章数量:1395137

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?

本文标签: SpeedPerformance difference between wpajax and init checks for AJAXPOST requests