Prevent Password Mail upon Register With LoginPress (Hook)

By default, WordPress sends an email notification to the site's admin and the user who is being registered (with the username and password) upon successful registration. 

This knowledgebase article will show how to prevent WordPress from sending the password reset email if you’ve custom password fields enabled with LoginPress (Hook).

If you’ve custom password fields enabled but, However, don’t want to send an extra email of the password reset when a user registers to your site.

Let’s get started!

How to Disable New User Notification Emails with LoginPress (Hook)

You can disable WordPress to send the reset password email to the new user if you enable the Custom Password Fields inside the LoginPress settings using some custom code. 

Here are the steps you need to follow in order to disable it:

Step 1: Enable LoginPress Custom Password Fields

First, go to the left sidebar of the WordPress admin dashboard of your website.

Navigate to LoginPress and click on the Settings option.

Settings

A new screen with all of the LoginPress Settings will open up.

From here, Enable the Custom Password Fields feature.

Disable New Users Email Notifications with Enable Custom Password Field

Step 2: Add the Snippet in the Child Theme’s functions.php File.

Once you’ve Enabled the Custom Password Fields, you’ll need to add the snippet in the child theme’s functions.php file to disable the reset password email sent to the user upon successful registration.

This code will ensure that only the admin gets the registration email upon new user registration and not the user who is being created, as it will set its new password from the registration form of LoginPress.

Here is the hook which we are going to use for this purpose.

wp_new_user_notification_email

Usage in functions.php:

function loginpress_wp_new_user_notification_email_cb( $wp_new_user_notification ) {

      $wp_new_user_notification['to'] = '';

      return $wp_new_user_notification;

}

add_filter( 'wp_new_user_notification_email', 'loginpress_wp_new_user_notification_email_cb' );

All Done! Easy right? This is how you can easily prevent WordPress from sending emails to new users upon registering by using the hook mentioned above.

Now it’s your turn! Let us know how much it helped you!

If you have any doubts or questions related to this matter, please don’t hesitate to contact our support team.

Still stuck? How can we help?

Updated on December 2, 2022

Documentation
LoginPress Support
triangular shape yellowish icon

Frequently Asked Questions (FAQs)

These FAQs answer the most common questions about our WordPress custom login page plugin.

three shapes icon

Is LoginPress WPML Compatible?

LoginPress is fully supported with multilingual. LoginPress is also compatible with WPML Plugin, which means you can easily translate your login page with WPML plugin according to the given translation options in the WPML plugin.

Is LoginPress translation ready?

Yes, LoginPress has full translation and localization support via the LoginPress textdomain. All .mo and .po translation files should go into the languages folder in the base of the plugin.

Is coding skills needed to use LoginPress?

No, It is very easy to setup. Just plug and play. Have fun!

How to Install or Use LoginPress Pro?

Step-by-step instructions on How to Upgrade from existing Free version to Pro
1. You have installed and set up the Free version already.
2. Upload the Pro version.
3. Pro features will be enabled automatically.
4. You don’t need to set up Free version options again.
5. Setup Pro features like Google fonts, Google reCaptcha, Choose themes, etc.

Where is my license key?

License key is the Order ID which looks like in this format.
WHI150807-1234-12345
You can find it in the email Sales Receipt.

three shapes icon

If you Still have Questions?

Get In Touch