0

I'm sure this isn't possible but I thought I would ask.

In my functions.php file I have a wp_mail function that sends an email to moderators when posts are made.

This email is sent to number of different address - these addresses might change.

I thought it would easier to set these email addresses in the WP Dashboard something like on custom page and then have functions.php update with the new emails.

Is this possible?

  • See the Newsletter Plugin, specifically the Edit Subscribers Page to get started. – eyoung100 Jun 24 '14 at 15:03
  • This is equivalent to "How do I expose an option in a settings page via the settings API?" and "How do I get the value of an option and pass it to wp_mail?" – Tom J Nowell Jun 24 '14 at 17:34
0

That's the purpose of admin area, isn't it? :)

In WordPress Settings API is mostly responsible for creating and processing admin area pages. It's not the friendliest part of core though to be honest.

I would look around for notification-related plugins, your requirements seem generic enough for good chances of finding something fitting.

0

Yes, you can use the action admin_menu and the function add_menu_page() to create a theme specific admin panel where you can add settings for the theme. In your example, it would be a panel where you could set the email addresses in which the newsletter is sent to. This value would be saved in the database and then pulled like any other Database data where needed to work in the wp_mail functionality.

The custom admin menus you see in plugins can also be created in a theme.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.