Approval Mail to Guest Poster on Post Approval in WordPress Php by Rajesh Kumar Sahanee - June 4, 2017June 4, 20171 Post Views: 4,830 Hello Friends, Today I am going to share how to send post approval mail to guest poster on post approval on your wordpress website. In this code I am going to use custom field (ap_author_email) to get author email used in AccessPresss Anonymous Post Plugin. You can use your custom field instead of ap_author_email. To make it work you just have to copy and paste below code in your theme’s functions.php file. functions.php PHP add_action('transition_post_status', 'send_mails_on_publish', 10, 3); function send_mails_on_publish($new_status, $old_status, $post) { if ('publish' !== $new_status or 'publish' === $old_status) return; $postid = $post->ID; /* fetching email from custom field here ap_author_email is custom used in AccessPress Anonymous Post Plugin */ $emails[] = get_post_meta($postid, '<strong>ap_author_email</strong>', true); $body = sprintf('Hi Your post has been approved! See <%s>', get_permalink($post)); wp_mail($emails, 'Your Post Approved!', $body); } 123456789101112131415 add_action('transition_post_status', 'send_mails_on_publish', 10, 3); function send_mails_on_publish($new_status, $old_status, $post) { if ('publish' !== $new_status or 'publish' === $old_status) return; $postid = $post->ID; /* fetching email from custom field here ap_author_email is custom used in AccessPress Anonymous Post Plugin */ $emails[] = get_post_meta($postid, '<strong>ap_author_email</strong>', true); $body = sprintf('Hi Your post has been approved! See <%s>', get_permalink($post)); wp_mail($emails, 'Your Post Approved!', $body);} Thanks Please share if you like