I need to auto-generate usernames upon WordPress registration. I have a custom registration form set up and would like to create the username in functions.php.
Can someone tell me why this isn't working? It seems like it should work after reading the WordPress Codex on customized registration forms?
function register_hook ( $user_id ) {
update_user_meta( $user_id, 'signup_username', 'the-auto-generated-name' );
// also tried this:
// update_user_meta( $user_id, 'user_login', 'the-auto-generated-name' );
}
add_action( 'user_register', 'register_hook' );