Created
March 1, 2016 18:12
-
-
Save victorknust/1a5fbdc70887fe06619e to your computer and use it in GitHub Desktop.
Storing WordPress user-selected password into database on registration
This file contains 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 | |
// Storing WordPress user-selected password into database on registration | |
// http://wp.me/p1Ehkq-gn | |
add_action( 'user_register', 'ts_register_extra_fields', 100 ); | |
function ts_register_extra_fields( $user_id ){ | |
$userdata = array(); | |
$userdata['ID'] = $user_id; | |
if ( $_POST['password'] !== '' ) { | |
$userdata['user_pass'] = $_POST['password']; | |
} | |
$new_user_id = wp_update_user( $userdata ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment