Skip to content

Instantly share code, notes, and snippets.

@haet
Created March 27, 2019 14:25
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 haet/d3414f0a13916dd800b3e7f81f1532db to your computer and use it in GitHub Desktop.
Save haet/d3414f0a13916dd800b3e7f81f1532db to your computer and use it in GitHub Desktop.
disable email template for multiple subjects
add_filter( 'haet_mail_use_template', 'customize_template_usage', 10, 2 );
function customize_template_usage( $use_template, $mail ){
if( strpos( $mail['subject'], 'Subject 1' ) !== false
|| strpos( $mail['subject'], 'Subject 2' ) !== false
|| strpos( $mail['subject'], 'Subject 3' ) !== false )
return false;
return $use_template;
}
// if you know the exact subject line you can also use == instead of strpos():
add_filter( 'haet_mail_use_template', 'customize_template_usage', 10, 2 );
function customize_template_usage( $use_template, $mail ){
if( $mail['subject'] == 'Subject 1'
|| $mail['subject'] == 'Subject 2'
|| $mail['subject'] == 'Subject 3' )
return false;
return $use_template;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment