Last active
January 9, 2025 06:58
-
-
Save benpearson/228ed69ac60a8734b92bb1a21e0fc4ab to your computer and use it in GitHub Desktop.
WordPress: Disable new user registration email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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