Skip to main content

Timeline for Notify admin when page is edited?

Current License: CC BY-SA 3.0

12 events
when toggle format what by license comment
Apr 13, 2017 at 12:37 history edited CommunityBot
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
S Oct 24, 2014 at 12:48 history suggested icc97 CC BY-SA 3.0
adding the fully merged code
Oct 24, 2014 at 12:19 review Suggested edits
S Oct 24, 2014 at 12:48
Aug 1, 2012 at 20:53 comment added Ian Dunn It's really hard to read the code without any indentation, line breaks, etc. Could you add it to the question and make sure it's readable? Or, if the code from the Codex worked for you, you should add that as a new answer and mark it as the accepted solution. In case that didn't solve the problem, I've updated my answer with some code to prevent getting e-mails on auto-saves.
Aug 1, 2012 at 20:51 history edited Ian Dunn CC BY-SA 3.0
added code to prevent emailing on auto-save
Aug 1, 2012 at 19:54 comment added pam 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 ); } }
Aug 1, 2012 at 19:48 comment added pam 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 ); }
Aug 1, 2012 at 19:47 comment added pam 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!
Aug 1, 2012 at 18:33 comment added Ian Dunn 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.
Aug 1, 2012 at 18:32 history edited Ian Dunn CC BY-SA 3.0
added code to comment out lines that are returning
Aug 1, 2012 at 17:29 comment added pam 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
Aug 1, 2012 at 6:27 history answered Ian Dunn CC BY-SA 3.0