If you have a multi-author blog, notifying authors when one of their articles is published will help generate engagement and discussion within your team. Recently, one of our readers asked if it was possible to email authors when their articles are published.

In this tutorial, we will show you how to send an email to authors when their articles are published in WordPress.

send emails to authors when an article is published

Method 1: Send notification to users using "Edit Flow"

The first thing you need to do is to install and activate the plugin " Edit Flow ". For more details, see our step-by-step guide on way to install a WordPress plugin.

« Edit Flow "Works without configuration to send email notifications. As soon as you activate the plugin, it will start sending email notifications to the authors each time their articles are published.

However, it does not forward email notifications to the site administrator. You can go to " Edit Flow> Notifications »And select activate the option« Always notify blog admin ».

Edit flow plugin WordPress for authors

Edit Flow is a powerful plugin, and it can do much more than just send email notifications.

2 Method: Send Notifications with the Better Notification Plugin

This method is for users who just want to send email notifications without editorial functionality. The first thing you need to do is install and activate the plugin " Better Notification ". After activation, you must access " Notifications> Add New To create an email notification.

Better notification plugin for email notification

You must first enter a title for this notification, you have the freedom to choose what you want.

In the field " Notification for You must select " New Post Published ". In the email sending options, you must check the box " Send this message to the author only ».

Now you need to write a subject line and the body of the email. " Better WordPress NotificationsOffers a handful of shortcodes that you can use in the body of the email.

For the subject of the email, you must enter:

[post_title] For the body of the message, you can use this template: Hello [user_nicename], We have just published your message "[post_title]". You can see it here: [permalink]

We look forward to seeing you!

Finally, you need to click on the Save button to save your new notification. The plugin will now send a notification email to authors when their articles are published on your WordPress blog.

3 Method: Send Notifications Manually to Article Authors

This method is for users who are comfortable with editing code in WordPress. You must therefore add this code either on your plugin, or on the file " functions.php Of your active theme.

function notifyauthor ($ post_id) {$ post = get_post ($ post_id); $ author = get_userdata ($ post-> post_author); $ subject = "Post Published:". $ post-> post_title. ""; $ message = "Hello". $ author-> display_name. ", Your article:" ". $ post-> post_title." "has been published. Read the article:" .get_permalink ($ post_id). "Thank you"; wp_mail ($ author-> user_email, $ subject, $ message); } add_action ('publish_post', 'notifyauthor');

This code works when a new post is posted to WordPress. It sends an email notification to the author using the title and message defined in the code. You can therefore modify the message of this code (Variable $ message).

Remember to always make a backup of your blog before this type of modification.

That's it for this tutorial. If you have any questions, do not hesitate to ask us in the forms of following comments.