最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

SpeedPerformance difference between `wp_ajax` and `init` checks for AJAXPOST requests?

programmeradmin3浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论