Add Snippet To Project
As a WordPress site owner, you might find the default email notifications for new user registration to be unnecessary or even annoying. Fortunately, it’s possible to disable these notifications for both administrators and users on your site. In this article, we’ll show you how to turn off these notifications so that you can streamline your site’s notifications and focus on more important matters.
function wpturbo_disable_new_user_notification_email( $new_user_email ) {
return false;
}
add_filter( 'wp_new_user_notification_email', 'wpturbo_disable_new_user_notification_email', 10, 3 );
The code snippet provided shows how to disable the new user notification email sent to both the admin and newly registered users. The function wpturbo_disable_new_user_notification_email()
takes in the $new_user_email
parameter, which will be the default email sent to the admin and user when a new user registers on a WordPress site.
Inside the function, return false
is used to stop the email from being sent. This essentially replaces the standard notification email with nothing.
The add_filter()
function is used to hook the wpturbo_disable_new_user_notification_email()
function to the wp_new_user_notification_email
filter, which runs every time a new user registers on the site. The 10
and 3
parameters passed in tell WordPress to pass 3
arguments to the hooked function and give it priority 10
, which means it will be executed after other functions hooked into the same filter with lower priority numbers have completed.
By using this code snippet, you can disable the new user notification email for admins and users on your site. Keep in mind that this may affect your site’s security, so use it with caution.