-
-
Save andrasguseo/3fd11aa0eea00f23b4444848b97ecf35 to your computer and use it in GitHub Desktop.
BCC site admin email on all Event Tickets' RSVP ticket emails so they get a copy of it too
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* BCC site admin email on all Event Tickets' RSVP ticket emails so they get a copy of it too | |
* | |
* From https://gist.github.com/cliffordp/4f06f95dbff364242cf54a3b5271b182 | |
* | |
* Reference: https://developer.wordpress.org/reference/functions/wp_mail/#using-headers-to-set-from-cc-and-bcc-parameters | |
* | |
*/ | |
function cliff_et_rsvp_bcc_admin_ticket() { | |
// get site admin's email | |
$bcc = sanitize_email( get_option( 'admin_email' ) ); | |
// set Headers to Event Tickets' default | |
$headers = array( 'Content-type: text/html' ); | |
// add BCC email if it's a valid email address | |
if ( is_email( $bcc ) ) { | |
$headers[] = sprintf( 'Bcc: %s', $bcc ); | |
} | |
return $headers; | |
} | |
add_filter( 'tribe_rsvp_email_headers', 'cliff_et_rsvp_bcc_admin_ticket' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment