Home / Archive / MemberPress: Disable the Default WordPress Password Reset Link E-Mail
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Disable the Default WordPress Password Reset Link E-Mail

If the "Disable Password Fields on membership registration forms" option is active in MemberPress settings (Dashboard > MemberPress > Settings > Account tab), MemberPress will trigger the default WordPress email containing a password reset link. This code snippet will prevent that email from being triggered.

Code Preview
php
<?php
function mepr_disable_password_reset_email( $recipients,  $subject, $message, $headers ) {
  $set_password_notification_subject = MeprHooks::apply_filters( 'mepr_set_new_password_title', sprintf( __( "[%s] Set Your New Password", 'memberpress' ), MeprUtils::blogname() ) );
	
  if ( $subject == $set_password_notification_subject ) {
    $recipients = array();
  }
	
  return $recipients;
}
add_filter( 'mepr-wp-mail-recipients', 'mepr_disable_password_reset_email', 10, 4 );

Comments

Add a Comment