Skip to content

Instantly share code, notes, and snippets.

@dwanjuki
Created February 7, 2023 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwanjuki/93331ac5c300f98523538128092212e7 to your computer and use it in GitHub Desktop.
Save dwanjuki/93331ac5c300f98523538128092212e7 to your computer and use it in GitHub Desktop.
Change Admin Activity emails recipient from Site Admin to the specified email address
<?php
/**
* The function below will change the recipient of Admin Activity Emails.
*
* 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_admin_activity_emails( $recipient, $email ) {
if ( $email->template == "admin_activity_email" ) {
$recipient = "someone@example.com"; // New admin activity recipient email goes here
}
return $recipient;
}
add_filter( 'pmpro_email_recipient', 'my_pmpro_redirect_admin_activity_emails', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment