Prevent redirect to wp-login.php

I guess you don’t have code on your new login form that supports ?action=lostpassword ? Your choices are either copy the relevant code from wp-login.php to your new form; you want the retrieve_password() function. Then you can post back to /login?action=lostpassword. use your own ‘lost password’ form, but post to /wp-login.php?action=lostpassword hook the lostpassword_redirect filter … Read more

Can I “protect” a page with a form asking for an email address?

What about filtering the_content? function se365701_require_email ( $content ) { if ( is_page( ‘require_email’ ) ) && !isset( htmlspecialchars( $_COOKIE[‘submitted_email’]) ) { return $form; // your MailChimp Form Code } else{ return $content; } add_filter( ‘the_content’, ‘se365701_require_email’ ); Note that your form provide itself may have a cookie or you may need to set it … Read more

Getting 401 from ajax using an application password

You should use cookie based authentication instead of basic auth. Delete the basic auth/application password authentication code. Follow the cookie authentication example that creates a post via the REST API from the REST API handbook: https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#cookie-authentication Create a valid nonce for use in your AJAX requests in PHP wp_create_nonce( ‘wp_rest’ ) as the docs tell … Read more