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