Last active
May 20, 2025 09:52
-
-
Save MaryOJob/329703724b555d7b98588e299921c2bc to your computer and use it in GitHub Desktop.
Change the Admin Email Recipient from Site Admin to the Specified Email Address for Specific Paid Memberships Pro Email Templates
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 | |
/** | |
* The function below will change the recipient of Admin Emails for Specified Email Templates | |
* You can see a list of all email templates here: | |
* https://www.paidmembershipspro.com/documentation/member-communications/list-of-pmpro-email-templates/ | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_redirect_specific_emails( $recipient, $email ) { | |
// List of templates you want to redirect | |
$redirect_templates = array( | |
'admin_activity_email', | |
'admin_approved', | |
'admin_notification_approval' | |
); | |
if ( in_array( $email->template, $redirect_templates ) ) { | |
$recipient = '[email protected]'; // New recipient email goes here | |
} | |
return $recipient; | |
} | |
add_filter( 'pmpro_email_recipient', 'my_pmpro_redirect_specific_emails', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment