Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/wp ajax nopriv (action)

This hook is functionally the same as wp_ajax_(action), however it is used to handle AJAX requests on the front-end for unauthenticated users, i.e. when is_user_logged_in() returns false. Unlike wp_ajax_(action) the ajaxurl javascript global property will not be automatically defined and must be included manually or by using wp_localize_script() with admin_url( 'admin-ajax.php' ) as the data.

This hook will not fire for authenticated users, i.e. when is_user_logged_in() returns true. To handle both unauthenticated and authenticated users, also use wp_ajax_(action).

To add AJAX callbacks to a plugin please see AJAX in Plugins.

This page is marked as incomplete. You can help Codex by expanding it.