Disclosure: We are a professional review site that receives compensation from the companies whose products we review. We test each product thoroughly and give high marks to only the very best. We are independently owned and the opinions expressed here are our own.
Do you run a multi-authored blog or have the occasional guest writer submit articles to your site? If so, does WordPress automatically notify the author when their article is published? If you aren’t sure you might want look into that? Some themes, may not have this function built into the theme. So that means you will always have to email your writers when you submit their articles.
If you have the occasional writer, then it isn’t a big deal. However, if you have a lot of articles going live everyday or you like to set dates for the articles to go live in the future then you will want to setup WordPress to automatically tell the writers when their work goes live. Image Source: Journal Entry
At first, this wasn’t a big deal, but over time, I was getting more requests for guest writers. Since I usually set guest articles to go live on Fridays mornings I try and edit the article a few days to the night before and then set the article to go live the next morning. Because of this, I would sometimes forget to send out an email. To fix this problem, I had to write some code to automatically send out emails.
I went back to through my code and I realized that the original code I had written was no longer there. That means that sometime last year I over wrote the code and I had to rewrite the code again.
How to Make WordPress Automatically Email Writers that Their Articles are Live
Since I couldn’t remember what code I used, I did a search and came up with a great script from WPRecipes.
All you do is add the below function to the functions.php file in your editor.
[php]
function wpr_authorNotification($post_id) {
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$message = "
Hi ".$author->display_name.",
Your post, ".$post->post_title." has just been published. Well done!
";
wp_mail($author->user_email, "Your article has been published. Please check the article and let us know if anything needs to be changed. Please do not forget to Tweet, Like, and Google +1 the article. ", $message);
}
add_action(‘publish_post’, ‘wpr_authorNotification’);
[/php]
I did not make any changes to the function, but I did change the message. The original one was short and to the point. I wanted to add a reminder for the writers. You can basically put whatever message you want in there, just keep it short.
Source Article: How to automatically email contributors when their posts are published and WordPress Essentials: The Definitive Guide To WordPress Hooks
Leave a Reply