Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
    
See wordpress.stackexchange.com/q/55516/73. –  toscho Jun 22 '12 at 20:45
add comment

3 Answers 3

up vote 4 down vote accepted

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 );
}
share|improve this answer
    
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
show 1 more comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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