Prevent Password Email 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 Theme’s functions.php File.

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

Note: It’s recommended to use a child theme to edit the functions.php file instead of the parent theme. There are chances to lose the modified code when you update your theme. It might cause some adverse effects on your website.

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 January 16, 2024

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

Where can I get support for LoginPress?

If you need help with LoginPress, you can contact us here. We’ll be happy to answer any questions about the plugin.

Do you have an affiliate program?

Yes, we have an affiliate program that you can sign up for here. As an affiliate, you’ll earn a commission on every sale you refer to us.

Do you offer refunds?

Yes, we offer a 14-day money-back guarantee on all of our plans. If you’re unsatisfied with LoginPress, simply contact us within 14 days of your purchase, and we’ll process a refund.

Can I upgrade my license after my initial purchase?

Yes, you can upgrade your LoginPress license at any time. Simply log into your account and go to the My Downloads page. From here, you can upgrade your license and download the latest version of the plugin.

Will LoginPress slow down my website?

No, LoginPress will not slow down your website. The plugin is lightweight and only loads the necessary files when someone tries to access your login page.

three shapes icon

If you Still have Questions?

Get In Touch