coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
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 … Read more