Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Notify post author once a new post is published **/
- function notify_author($post_id) {
- $post = get_post($post_id);
- $author = get_userdata($post->post_author);
- $subject = "A new Post Published: ".$post->post_title."";
- $message = "
- Hi ".$author->display_name.",
- Your post, \"".$post->post_title."\" has just been published.
- View post: ".get_permalink( $post_id )."
- Thanks"
- ;
- wp_mail($author->user_email, $subject, $message);
- }
- add_action('publish_post', 'notify_author');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement