Skip to content

Instantly share code, notes, and snippets.

@danjjohnson
Created April 29, 2016 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danjjohnson/a24edacf7943e70d3a163bf329534edc to your computer and use it in GitHub Desktop.
Save danjjohnson/a24edacf7943e70d3a163bf329534edc to your computer and use it in GitHub Desktop.
WP Job Manager: Send an email to employer when their job listing expires
function listing_expired_send_email($post_id) {
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$message = "
Hi ".$author->display_name.",
Your listing, ".$post->post_title." has now expired: ".get_permalink( $post_id );
wp_mail($author->user_email, "Your job listing has expired", $message);
}
add_action('expired_job_listing', 'listing_expired_send_email');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment