• Hello,

    I would like to be able to send an automatic email to the author of a post when their post is saved as “pending” (from a previous “pending” status) + a certain custom field (“statut_article”) = 2.

    I guess it should be like:

    function notify_trash( $post ) {
    $rejete = get_post_meta($post->ID, 'statut_article');
    if ($rejete == '2') :
      $user_info = get_userdata ($post->post_author);
      $strTo = array ('[email protected]');
      $strSubject = 'Fstoppers: ' . $user_info->user_nicename . ' submitted a post';
      $strMessage = '"' . $post->post_title . '" by ' . $user_info->user_nicename . ' was submitted a post for review at ' . 			wp_get_shortlink ($post->ID) . '&preview=true. Please proof.';
      wp_mail( $strTo, $strSubject, $strMessage );
    endif;
    }
    add_action( 'transition_post_status', 'notify_trash', 10, 3 );

    But this doesn’t work… Any idea?

    Thanks!

  • The topic ‘Send an email when submit to review custom field?’ is closed to new replies.