Skip to content

Instantly share code, notes, and snippets.

@chandra10207
Created January 19, 2018 04:30
Show Gist options
  • Save chandra10207/38f8b2a43030f580baf6323ae469ce96 to your computer and use it in GitHub Desktop.
Save chandra10207/38f8b2a43030f580baf6323ae469ce96 to your computer and use it in GitHub Desktop.
When resetting passwords in WordPress a random password is automatically generated and pre-filled in the password field. to disable random password for password resets use this code.
add_filter( 'random_password', 'itsg_disable_random_password', 10, 2 );
function itsg_disable_random_password( $password ) {
$action = isset( $_GET['action'] ) ? $_GET['action'] : '';
if ( 'wp-login.php' === $GLOBALS['pagenow'] && ( 'rp' == $action || 'resetpass' == $action ) ) {
return '';
}
return $password;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment