Hot answers tagged


When a user logs into a protected page, WordPress sets a cookie. We can check for the existence of that cookie with this conditional: if ( isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) ) { // Do stuff. } Also, you should be aware that only one password is stored in cookies at a time, to the last entry viewed. By default, the cookie expires 10 days from ...


Your hook name uses an underscore: add_action( 'wp_ajax_save_form', 'save_form' ); add_action( 'wp_ajax_nopriv_save_form', 'save_form' ); But your action uses a hyphen. action: 'save-form' These need to match: action: 'save_form' Also, your AJAX callback appears to be in apps/save_signups.php, but you are only requiring that file inside the ...


A response is needed from php side after sending an AJAX call. // ... rest of the code if ( is_user_logged_in() ) { wp_send_json_success(); } else { wp_send_json_error( null, 403 ); } // ... rest of the code And then in your JS code add a new check for jqXHR.status == 403 error. Documentations: wp_send_json_success wp_send_json_error

Only top voted, non community-wiki answers of a minimum length are eligible