Skip to content

Instantly share code, notes, and snippets.

@imfaisalkh
Created July 5, 2019 17:33
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 imfaisalkh/1e2a6efd3c1777cb36c3d6fa7dd6524b to your computer and use it in GitHub Desktop.
Save imfaisalkh/1e2a6efd3c1777cb36c3d6fa7dd6524b to your computer and use it in GitHub Desktop.
Disabling sending certain email at certain events
<?php
#-----------------------------------------------------------------#
# Disable Emails Sending When Job Listing Approved
#-----------------------------------------------------------------#
function disable_mail_job_approved() {
remove_filters_with_method_name( 'pending_to_publish', 'listing_published_send_email' );
remove_filters_with_method_name( 'pending_payment_to_publish', 'listing_published_send_email' );
}
add_action( 'init', 'disable_mail_job_approved' );
#-----------------------------------------------------------------#
# Disable Emails Sending When Resume Listing Approved
#-----------------------------------------------------------------#
function disable_mail_resume_approved() {
remove_filters_with_method_name( 'pending_to_publish', 'resume_published_send_email' );
remove_filters_with_method_name( 'pending_payment_to_publish', 'resume_published_send_email' );
}
add_action( 'init', 'disable_mail_resume_approved' );
#-----------------------------------------------------------------#
# Disable Emails Sending When Resume Expires
#-----------------------------------------------------------------#
function disable_mail_resume_expires() {
remove_filters_with_method_name( 'transition_post_status', 'resume_expired_send_email', 10, 3 );
}
add_action( 'init', 'disable_mail_resume_expires' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment