wp_ajax_nopriv_(action)
Fires non-authenticated Ajax actions for logged-out users.
The dynamic portion of the hook name, $action, refers to the name of the Ajax action callback being fired.
Usage
add_action( 'wp_ajax_nopriv_(action)', 'wp_kama_ajax_nopriv_action' ); /** * Function for `wp_ajax_nopriv_(action)` action-hook. * * @return void */ function wp_kama_ajax_nopriv_action(){ // action... }
Changelog
Since 2.8.0 | Introduced. |
Where the hook is called
In file: /wp-admin/admin-ajax.php
wp-admin/admin-ajax.php 207
do_action( "wp_ajax_nopriv_{$action}" );
Where the hook is used in WordPress
wp-admin/admin-ajax.php 169
add_action( 'wp_ajax_nopriv_generate-password', 'wp_ajax_nopriv_generate_password' );
wp-admin/admin-ajax.php 171
add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );