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.

I found this previous post to automatically notify the admin when a post or page is published: Alert Email when any Post or Page is Changed

Works like a charm, thanks! However, it looks like the page has to be changed from draft or pending to published to trigger the action. Is there a modification to notify the admin when an already published page is updated?


share|improve this question
Hi Pam, welcome to WPSE. Make sure you check out the About and FAQ pages, since this site has some unique mechanics that you'll need to know about. –  Ian Dunn Aug 1 '12 at 6:28

2 Answers 2

You're right .. many of the notification plugins require a change of state and don't actually track if there is a new 'revision' to a post or page.

Recently WPMU did a long story on plugins that will track activity and you might find it helpful as it identifies a few plugins ...


share|improve this answer
Thank you, I just reviewed that story. I had looked at most of those plugins, and they don't appear to be the answer for me, as they log but don't notify. I'd like to be warned immediately that changes are being made, not just be able to trace it after the fact. My site isn't really multi-user, but I do need to delegate editing authority to a few other staff and would like to keep an eye on changes. –  pam Aug 1 '12 at 17:32

You can register TheDeadMedic's function to fire on the save_post action, which runs every time a post is saved, regardless of whether or not the status changed.

add_action( 'save_post', '__notify_admin_on_publish', 10, 3 );

Then, comment out these lines in his function:

//if ( $new_status != 'publish' || $old_status == 'publish' )

To prevent getting an e-mail for autosaves, add this code to the top of the function:

global $post;
if( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || $post->post_status == 'auto-draft' )
share|improve this answer
Thank you, this looks perfect. However, I can't get it to work. I tried putting it in functions.php and then making it a plugin. It doesn't break anything, just no result when I save an update to a page. I also used the admin notification script on the wordpress codex page for save_post [link]codex.wordpress.org/Plugin_API/Action_Reference/save_post, and also had no result. Looks like the save_post action is not triggering for me? thanks –  pam Aug 1 '12 at 17:29
It looks like his function is returning if the post was already published, so I updated my answer to show you how to disable that part of it. –  Ian Dunn Aug 1 '12 at 18:33
Hi! Well, that didn't work, but I managed to modify the script suggested at the WP codex. Unfortunately, it sends a mail every time there is an autosave as well. Code in next post, thanks for your help! –  pam Aug 1 '12 at 19:47
add_action( 'save_post', 'my_project_updated_send_email' ); function my_project_updated_send_email( $post_id ) { $post_title = get_the_title( $post_id ); $post_url = get_permalink( $post_id ); $subject = 'A post has been updated'; $message = "A post has been updated on your website:\n\n"; $message .= "<a href='". $post_url. "'>" .$post_title. "</a>\n\n"; //send email to admin wp_mail( get_option( 'admin_email' ), $subject, $message ); } –  pam Aug 1 '12 at 19:48
Foolish me, the original script from the wpcodex works fine: add_action( 'save_post', 'my_project_updated_send_email' ); function my_project_updated_send_email( $post_id ) { //verify post is not a revision if ( !wp_is_post_revision( $post_id ) ) { $post_title = get_the_title( $post_id ); $post_url = get_permalink( $post_id ); $subject = 'A post has been updated'; $message = "A post has been updated on your website:\n\n"; $message .= "<a href='". $post_url. "'>" .$post_title. "</a>\n\n"; //send email to admin wp_mail( get_option( 'admin_email' ), $subject, $message ); } } –  pam Aug 1 '12 at 19:54

Your Answer


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.