Created
October 4, 2021 09:37
-
-
Save ipokkel/fc24bfd35cc5075e2b0b6e92b2ebb110 to your computer and use it in GitHub Desktop.
Change the email address for all admin related checkout emails in 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 email address for all admin related checkout emails in Paid Memberships Pro. | |
* | |
* 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_change_admin_to_email_for_checkout( $user_email, $email ) { | |
if ( strpos( $email->template, 'checkout_' ) !== false && strpos( $email->template, '_admin' ) !== false ) { | |
$user_email = '[email protected]'; // Set recipient email here. | |
} | |
return $user_email; | |
} | |
add_filter( 'pmpro_email_recipient', 'my_pmpro_change_admin_to_email_for_checkout', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on https://gist.github.com/andrewlimaza/78a4e1fb266b633aa5b138047576bfcc by @andrewlimaza