Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WPJM: Send an email to employer when their job is approved.
function listing_published_send_email($post_id) {
if( 'job_listing' != get_post_type( $post_id ) ) {
return;
}
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$message = "
Hi ".$author->display_name.",
Your listing, ".$post->post_title." has just been approved at ".get_permalink( $post_id ).". Well done!
";
wp_mail($author->user_email, "Your job listing is online", $message);
}
add_action('pending_to_publish', 'listing_published_send_email');
add_action('pending_payment_to_publish', 'listing_published_send_email');
@kwafoawua

This comment has been minimized.

Copy link

kwafoawua commented Jan 18, 2017

Hello Dan I addded this code to my functions.php in theme but it isn't sending any email.
Why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.