0

I looking for something like this: I have two (or more) groups of users. Each group is responsible to different person. So e.g. if someone from group A send draft, person responsible to group A get mail about it and can publish this post.

Sorry if something isn't clear. I can't find something like this.

2
  • Could you narrow down which emails verbatim you are talking about? WP sends quite a few of them.
    – Rarst
    Feb 20, 2015 at 12:19
  • I mean email about new pending posts.
    – hgruafha9j
    Feb 20, 2015 at 13:42

1 Answer 1

0
add_action('future_to_pending', 'send_emails_on_new_event');
add_action('new_to_pending', 'send_emails_on_new_event');
add_action('draft_to_pending', 'send_emails_on_new_event');
add_action('auto-draft_to_pending', 'send_emails_on_new_event');

/**
 * Send emails on event publication
 *
 * @param WP_Post $post
 */
function send_emails_on_new_event($post) {
    $emails = "[email protected], [email protected]"; //If you want to send to site administrator, use $emails = get_option('admin_email');
    $title = wp_strip_all_tags(get_the_title($post->ID));
    $url = get_permalink($post->ID);
    $message = "Link to post: \n{$url}";

    wp_mail($emails, "New post published: {$title}", $message);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.