Email Post Contributors When Their Posts Are Published

This WordPress code snippet below will email the Post Author a “post published successful” confirmation for every post published.
The code can be also used for the WordPress admin to check when, how and whats is published to the website, this WordPress code snippet can be useful if you want to track down publishers work.

Email Post Contributors When Their Posts Are Published code snippet:

/**
 *
 * Email Post Contributors When Their Posts Are Published
 */
if ( ! function_exists( 'ns_author_notification' ) ) {
function ns_author_notification( $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', 'ns_author_notification' );
}

Send me a message if you are interested to publish your WordPress code snippet here on my website, I will be more than happy to have your WordPress code snippet published on my Website WordPress code snippets section.

Are you tired and worried about your WordPress site security? Please have a look on my Support & Maintenance Plans. My Support & Maintenance Plans can be tailored to your specific needs, you just need to drop a line on my contact form (here) and I will get back to you ASAP.

ABOUT AUTHOR

Nuno

I am a Freelance Web Developer and WordPress Expert based in London with a wealth of website development and support experience. I am great at problem solving and developing quick solutions.

LEAVE A COMMENT

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • LET'S TALK!

    Fill in the form below to make an enquiry or find my contact details on my contact page.

  • This form collects your name and email address so that I can respond to the enquiry(ies) that you submit via this website. Please check my privacy policy for the full story on how I use, protect and manage your submitted data.