Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimcoleman/df027dfc84e0d0bcd1b12621fa744a3b to your computer and use it in GitHub Desktop.
Save kimcoleman/df027dfc84e0d0bcd1b12621fa744a3b to your computer and use it in GitHub Desktop.
Disable any email sent to the Member/User by Paid Memberships Pro
<?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 );
@laurenhagan0306
Copy link

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment