Fires authenticated Ajax actions for logged-in users.
The dynamic portion of the hook name, $action
, refers to the name of the Ajax action callback being fired.
wp_ajax_
hooks follows the format “wp_ajax_$action
“, where $action
is the ‘action
‘ field submitted to admin-ajax.php
.add_action( 'wp_ajax_nopriv_add_foobar', 'prefix_ajax_add_foobar' );
. To allow both, you must register both hooks!File: wp-admin/admin-ajax.php
Version | Description |
---|---|
2.1.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/wp_ajax_action