Speed/Performance difference between `wp_ajax` and `init` checks for AJAX/POST requests?

Question

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'] );   // or 'admin_init'

public function callback_Function()
{
    if(!empty($_POST['action_name]))
        ....
}

my main interest here is if there is any significant speed/performance difference?

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/speed-performance-difference-between-wp_ajax-and-init-checks-for-ajax-post-requests/">

Speed/Performance difference between `wp_ajax` and `init` checks for AJAX/POST requests?</a>
0
T.Todua 2 months 0 Answers 60 views 0

Leave an answer