Support

Account

Home Forums General Issues Field last update date stamp? Reply To: Field last update date stamp?

  • Glad that you managed to resolve it, with regards to wp_mail it should be semi-straight forward

    // Updates FYI last update timestamp when custom field is updated
    function my_acf_save_post( $post_id ) {
      // bail out early if we don't need to update the date
      if( is_admin() || $post_id == 'new' ) {
         return;
       }
       global $wpdb;
       $datetime = date("F j, Y g:i a");
       $query = "UPDATE $wpdb->posts
    	     SET
                  post_modified = '$datetime'
                 WHERE
                  ID = '$post_id'";
        $wpdb->query( $query );
    
        $to = '[email protected]';
        $subject = 'Update to ' . get_the_title($post_id);
        $message = "There has been an update to your post " . $get_the_title($post_id) . "/n You can click to see this here:" . get_permalink($post_id);
    
        wp_mail($to, $subject, $message);
        
    }
    // run after ACF saves the $_POST['acf'] data
    add_action('acf/save_post', 'my_acf_save_post', 20);

    This is untested mind, but it seems like it would work. Through using wp_mail() to send, it should follow standard site sending protocol (i.e. if you have an SMTP plugin or however your site sends by default).