Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MaryOJob/329703724b555d7b98588e299921c2bc to your computer and use it in GitHub Desktop.
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
<?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