Send mail to author when custom post type is saved
Try this way: function send_emails_on_new_event( $post ) { $emails=”[email protected]”; $headers=”From: Name <[email protected]>”; $title = wp_strip_all_tags( get_the_title( $post->ID ) ); $message=”New post created”; if ( get_post_type( $post->ID ) === ‘documents’ ) { wp_mail( $emails, ‘New Post’, $message, $headers ); } } add_action( ‘pre_post_update’, ‘send_emails_on_new_event’ ); From the Code Reference: pre_post_update: Fires immediately before an existing post … Read more