Hey there,
I have a form in the footer of my website for users to submit their email address to join our mailing list. My initial thought was to create a custom post type of email\_capture and using the rest api to make a post request at BASEURL + “/wp-json/wp/v2/email\_capture/”. I am receiving a 401 “Sorry, you are not allowed to create posts as this user.”
Is it possible to create a custom post type or a custom endpoint that allows anonymous posting but restricts read capabilities to administrators? Or should I take a completely different approach.
Similar stack overflow question [here](https://stackoverflow.com/questions/70980067/wordpress-rest-api-posting-data-from-a-form-as-a-guest-user) although no working response.
Thanks in advance.
[ad_2]
Why are you trying to capture emails this way? You’re doing it wrong. Either integrate something like hubspot or use gravity forms or other solid plugin to store the data of submissions.
You can use Javascript fetch api and make post request to custom function. save emails in wp_options or any custom table instead of CPT.
But there are better ways to manage email lists.
Mailchimp is your friend and free to start.