Title: Add new subscriber through PHP
Last modified: August 30, 2016

---

# Add new subscriber through PHP

 *  Resolved [jbx](https://wordpress.org/support/users/jbx/)
 * (@jbx)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/add-new-subscriber-through-php/)
 * Is there a PHP function I can use to add a new subscriber programmatically?
 * I have another form (in another plugin) for which I am collecting the user’s 
   email address. And I have a hook available to know when the form is submitted(
   and I can also add a custom checkbox such as ‘Subscribe me to the newsletter’).
   What I am missing however is the subscription part after collecting the email
   address.
 * I tried to follow the code in `add.php` and it seems that it is saving a subscriber
   using `NewsletterUsers::instance()->save_user($subscriber)`, however I am not
   sure if it is safe to use from my own `functions.php` and whether there is any
   special considerations I need to take care of, like compulsory fields, API key
   etc.
 * [https://wordpress.org/plugins/newsletter/](https://wordpress.org/plugins/newsletter/)

Viewing 1 replies (of 1 total)

 *  [skylarkcob](https://wordpress.org/support/users/skylarkcob/)
 * (@skylarkcob)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/add-new-subscriber-through-php/#post-8135795)
 * Please help me for this question.
 * Thank you.

Viewing 1 replies (of 1 total)

The topic ‘Add new subscriber through PHP’ is closed to new replies.

 * ![](https://ps.w.org/newsletter/assets/icon-256x256.png?rev=1052028)
 * [Newsletter - Send awesome emails from WordPress](https://wordpress.org/plugins/newsletter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/newsletter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/newsletter/)
 * [Active Topics](https://wordpress.org/support/plugin/newsletter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/newsletter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/newsletter/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [skylarkcob](https://wordpress.org/support/users/skylarkcob/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/add-new-subscriber-through-php/#post-8135795)
 * Status: resolved