Skip to content

Instantly share code, notes, and snippets.

@MaryOJob
Last active April 23, 2025 10:43
Show Gist options
  • Select an option

  • Save MaryOJob/c6b5ac14fe18325619b0af4df80c5baf to your computer and use it in GitHub Desktop.

Select an option

Save MaryOJob/c6b5ac14fe18325619b0af4df80c5baf to your computer and use it in GitHub Desktop.
BCC Other Emails on Specific Email Templates - PMPro
<?php // DO NOT COPY THIS LINE, it will trigger a fatal error. Copy from below please!
/*
* Bcc admin on specific email templates only
* more then one can be added like this:
* $headers[] = "Bcc:" . "otheremail@domain.com,anotheremail@domain.com";
* You can change the conditional to check for a certain $email->template or some other condition before adding the BCC.
* Please add the below code to your site by following this guide:
* https://www.paidmembershipspro.com/how-to-add-code-to-wordpress/
*/
function my_pmpro_email_headers_admin_emails($headers, $email) {
//bcc approval emails
// if($email->template == "admin_approved" || $email->template == "admin_denied" || $email->template == "admin_notification_approval") {
// bcc on 'recurring payment email reminders' template and membership expired email template for example
if($email->template == "membership_recurring" || $email->template == "membership_expired") {
// add bcc multiple emails
// $headers[] = "Bcc:" . "other1@email.com, other2@email.com, other3@email.com, other4@email.com, other5@email.com";
// add bcc to one email only
$headers[] = "Bcc:" . "other5@email.com";
}
return $headers;
}
add_filter("pmpro_email_headers", "my_pmpro_email_headers_admin_emails", 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment