Post Status Transitions and wp_mail
-
I wrote a small bit of code to send an email to the admin when a pending custom post type is submitted for review (pending status). It works fine.
But when I try to notify the user that their post has been published (when the status changes from pending to publish) the email isn’t generated for them? Is there anything wrong with the following:
function notify_submitter() { global $post; $custom = get_post($post->ID); $author = get_userdata($custom->post_author); $author_email = $author->user_email; $message = "message here..."; $headers = 'From: me <[email protected]>' . "\r\n"; wp_mail($author_email, "subject here...", $message, $headers); } add_action('pending_to_publish_[custom_post_type]', 'notify_submitter');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Post Status Transitions and wp_mail’ is closed to new replies.