Skip to content

Instantly share code, notes, and snippets.

@Dizolivemint
Last active April 5, 2021 22:44
Show Gist options
  • Save Dizolivemint/9a0060d0cd26b09cc73c59dd81927c2c to your computer and use it in GitHub Desktop.
Save Dizolivemint/9a0060d0cd26b09cc73c59dd81927c2c to your computer and use it in GitHub Desktop.
WordPress Password Save Fix
// We want our front-end scripts queued on the login pages only
add_action( 'login_enqueue_scripts', array( $this, 'add_scripts' ) );
/* Hide the username with CSS, instead of as a hidden form field. */
// Dumb-browser-friendly solution is to wrap field in hidden div
$( '#resetpassform input[id=\'user_login\']' ).wrap(
'<div style="display:none">')
// Browsers are more likely to recognise the user ID if it's a text field
$( '#resetpassform input[id=\'user_login\']' ).attr( 'type', 'text' )
// Just in case, make sure the textfield isn't editable by the user
$( '#resetpassform input[id=\'user_login\']' ).attr( 'readonly', true )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment