Forked from strangerstudios/my_pmpro_disable_member_emails.php
Last active
April 14, 2021 03:30
-
-
Save kimcoleman/df027dfc84e0d0bcd1b12621fa744a3b to your computer and use it in GitHub Desktop.
Disable any email sent to the Member/User by Paid Memberships Pro
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 | |
/** | |
* The function below will disable any email sent to the Member/User by Paid Memberships Pro. | |
* The admin emails will still be sent as intended. | |
* | |
* 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_disable_member_emails( $recipient, $email ) { | |
if ( strpos( $email->template, "_admin" ) == false ) { | |
//this is not an admin email template | |
$recipient = NULL; | |
} | |
return $recipient; | |
} | |
add_filter( 'pmpro_email_recipient', 'my_pmpro_disable_member_emails', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Methods to Totally Disable, Reroute, or Selectively Disable Paid Memberships Pro Emails to the Member/User or Admin" at Paid Memberships Pro here: https://www.paidmembershipspro.com/methods-to-totally-disable-reroute-or-selectively-disable-paid-memberships-pro-emails-to-the-memberuser-or-admin/