Created
February 14, 2020 08:55
-
-
Save andrewlimaza/fc372ea171888e5da21f9a4c37897c05 to your computer and use it in GitHub Desktop.
Change Admin "To" address for admin emails [Paid Memberships Pro]
This file contains 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 | |
/** | |
* Change the "To:" header for admin emails for Paid Memberships Pro. | |
* Follow this guide to add custom code to your site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_change_admin_to_email( $headers, $email ){ | |
if( strpos( $email->template, "_admin" ) !== false ) { | |
//add different email for admin emails. | |
$headers[] = "To: " . "otheremail@domain.com"; | |
} | |
return $headers; | |
} | |
add_filter( "pmpro_email_headers", "my_pmpro_change_admin_to_email", 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @jescott2, here is an updated code that should work for you - https://gist.github.com/andrewlimaza/78a4e1fb266b633aa5b138047576bfcc