Forked from andrewlimaza/pmpro-change-admin-to-email.php
Last active
March 20, 2025 14:27
-
-
Save MaryOJob/2a1a83d44b14c7a8e41f34d4761a411f to your computer and use it in GitHub Desktop.
Add bcc for PMPro admin emails [Paid Memberships Pro]
This file contains hidden or 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 // do not copy this line | |
/** | |
* Add bcc for PMPro admin emails | |
* Follow this guide to add custom code to your site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_email_headers_admin_emails($headers, $email) { | |
// bcc emails already going to admin_email | |
if (strpos($email->template, '_admin') !== false) { | |
// Ensure headers is an array | |
if (!is_array($headers)) { | |
$headers = []; | |
} | |
// Add BCC recipients | |
$headers[] = 'Bcc: [email protected], [email protected]'; | |
} | |
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