4

Are there any plugin or code that sends out a email to me (admin) when a author or writer publish a post?

6

No need for plugin here are a few lines of code you can modify and paste in your themes functions.php file and you will get a new email whenever a post is published:

add_action('publish_post', 'send_admin_email');
function send_admin_email($post_id){
    $to = 'admin@email.here';
    $subject = 'mail subject here';
    $message = "your message here ex: new post published at: ".get_permalink($post_id);
    wp_mail($to, $subject, $message );
}
  • bainternet thank you it works perfect. but how can i add the subject and body field to email? – 1907 Jun 22 '12 at 20:19
  • and also if possible category field – 1907 Jun 22 '12 at 20:41
  • hmmmm, the answer shows how to set both subject and body of the mail (message = body, in email) – Bainternet Jun 22 '12 at 20:53
  • what i try to say is: i want to add title of the post and body of the post, and category in to email. – 1907 Jun 22 '12 at 20:58
  • ok then, for the title use: get_the_title($post_id); and for the categories use $categories = get_the_category($post_id); implode(" ,",$categories); – Bainternet Jun 22 '12 at 21:02
1

http://wordpress.org/extend/plugins/email-alerts/ this is good for a single or multisite set up where each user wants different email alert settings. Activate the plugin and then go to the user's profile to update the alert settings.

0

There is a plugin for this: http://wordpress.org/extend/plugins/email-post-changes/

After install go to Settings of the plugin (the settings link in the plugin list).

Enter your Email Adress and make sure to enable "Drafts" at the bottom - this will also send you notifications on new posts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.