Skip to content

Instantly share code, notes, and snippets.

@benpearson
Last active January 9, 2025 06:58
Show Gist options
  • Save benpearson/228ed69ac60a8734b92bb1a21e0fc4ab to your computer and use it in GitHub Desktop.
Save benpearson/228ed69ac60a8734b92bb1a21e0fc4ab to your computer and use it in GitHub Desktop.
WordPress: Disable new user registration email
<?php
/**
* Admin emails
*/
function dt_disable_new_user_registation_email() {
remove_action('register_new_user', 'wp_send_new_user_notifications');
remove_action('edit_user_created_user', 'wp_send_new_user_notifications', 10, 2);
add_action('register_new_user', 'dt_wp_send_new_user_notifications');
add_action('edit_user_created_user', 'dt_wp_send_new_user_notifications', 10, 2);
}
add_action('init', 'dt_disable_new_user_registation_email');
function dt_wp_send_new_user_notifications($user_id, $notify = 'user') {
wp_new_user_notification($user_id, null, $notify);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment