WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a custom post type that makes use of custom fields over the default editor. I want to receive an email notification when an update to the post is made. The email does not have to show the diff (though it would be nice).

I've tried Email Post Changes and it requires you to have "Revisions" enabled. I've tried enabling it and I am guessing, because I am not using the default editor, that it won't work without it.

Any thoughts on either getting the plugin working or figuring out how to have an email sent when a custom post type is updated?

share|improve this question
up vote 1 down vote accepted

If you publish a post, also custom post type, the hook get form status and post_type - {$new_status}_{$post->post_type} - is active and you can use this hook for send an mail. As an examaple for publish music: add_action('publish_music', 'fb_my_function'); You can also send the revision inside the mail, the revision is only a other post type and can get from the database and add to the message of the mail. Maybe you can see the possibilities on my last plugin, send mails for comments and posts.

An simple example for custom post type "Archive"

public $post_type_1 = 'archiv';

add_action( 'publish_' . $this -> post_type_1, array( $this, 'fb_my_function') );

        public function fb_my_function( $post_id = FALSE ) {

            if ( $post_id ) {
                // get data from current post
                $post_data = get_post( $post_id );
                //var_dump($post_data);exit; <-- see this for all content or use the id for get the revisons

                // get mail from author
                $user_mail = get_userdata( $post_data -> post_author );

                // email addresses
                $to = 'test@example.com'
                // email subject
                $subject = get_option( 'blogname' ) . ': ' . $post_data -> post_title;
                // message content
                $message = $post_data -> post_content . ' ' . PHP_EOL .  
                    get_author_name( $post_data -> post_author ) . ' ' . PHP_EOL . . 
                    get_permalink( $post_id );
                // create header data
                $headers = 'From: ' . 
                    get_author_name( $post_data -> post_author ) . 
                    ' (' . get_option( 'blogname' ) . ')' . 
                    ' <' . $user_mail -> user_email . '>' . 
                // send mail

            return $post_id;
share|improve this answer
Thank you for this! I will take a closer look and update the question accordingly. – Jonathan Wold Jun 7 '11 at 17:29

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.