If your blog is Multi-authored then it can be very cool to let your email contributors know when their post are online. Today i am going to show you can do this automatically each time a post is published. Its very simple, nothing complicated.
Copy the code below and paste it on your functions.php file. Then save the file, and you’re done!
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 is online", $message);
}
add_action('publish_post', 'wpr_authorNotification');
Thanks to Daniel Pataki for the great piece of code!
The post How to Automatically Email Contributors When Their Posts Are Published! appeared first on WordPress Experts.