Functions.php : Disable New User Registration Admin Emails

This allows you to disable the new user emails sent to the default admin email set under Settings > General, ‘Administration Email Address’ without installing an additional plugin.

To start,make sure you have admin access to the backend of WordPress. Because this requires you to have the ability to add/edit the code snippet below onto the functions.php file within the current theme folder.
				
					//Disable the new user notification sent to the site admin
function smartwp_disable_new_user_notifications() {
//Remove original use created emails
remove_action( 'register_new_user', 'wp_send_new_user_notifications' );
remove_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );

//Add new function to take over email creation
add_action( 'register_new_user', 'smartwp_send_new_user_notifications' );
add_action( 'edit_user_created_user', 'smartwp_send_new_user_notifications', 10, 2 );
}
function smartwp_send_new_user_notifications( $user_id, $notify = 'user' ) {
if ( empty($notify) || $notify == 'admin' ) {
return;
}elseif( $notify == 'both' ){
//Only send the new user their email, not the admin
$notify = 'user';
}
wp_send_new_user_notifications( $user_id, $notify );
}
add_action( 'init', 'smartwp_disable_new_user_notifications' );
				
			
If you have questions or need any help understanding and implementing these changes, please let me know at delice@wpquicksupport.com

Tools we are proud to recommend

Set an appointment with a specialist
to get the support you need.

Loading...
WP Quick Support strives to ensure the protection of your personal information through responsible practices. All personal information collected by WP Quick Support is done so exclusively with your consent, by means of a form posted on our website, an email received from you or by telephone. No information is collected automatically.