0

I have a simple <input type="email"> that I want to use to create a subscription form for mailchimp newsletter. I will use the HTTP API and no plugin, this because I think this will be less overkill for the app. I have only two minor question about this implementation:

1) I need to pass to my plugin or function file the wp_ajax_nopriv and wp_ajax_ actions as normally I do with forms to manage the data right?

2) How I can manage the unsubscribe action from the user? I need to setup a link or something similar that will rely on a dedicated url qith action as param?

  • I guess you're using the Mailchimp API to subscribe and unsubscribe users? Why not just use their UIs? – Rup Jan 22 at 12:58
  • I see you mentioned the ancient admin AJAX API, but I'm unsure why. You shouldn't use that API to handle form requests, and you should use the modern REST API for AJAX requests. If you've been using admin AJAX to submit forms in the past you should stop doing that. Keep in mind that the ins and outs of using the MailChimp API are not in scope of this stack, and that you'll get more answers by asking 1 question per question rather than bundling it all into a single question – Tom J Nowell Jan 22 at 13:17
  • Using the API just for a sign up form seems overkill. Mailchimp gives you the HTML for a form that will work without any additional work. Why not just use that? – Jacob Peattie Jan 22 at 13:33
  • @TomJNowell Yes, I'm still using wp_ajax_, this because I didn't know how to use REST API to manage form submission at the moment. If you post a link to docs and examples I will appreciate. – sialfa Jan 22 at 13:38
  • @Rup you have right, I just wanna do some practices with wp api and have a full customized solution in my bs4 theme, this is why. But I will consider this option. – sialfa Jan 22 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.