By default, UsersWP lets users login via their email address or their chosen username. This is in sync with the native WordPress behavior. However, if you prefer, you can choose to replace the “username” placeholder on your login forms, and replace it with “email”.
How to Replace the “Username” Placeholder Text?
To accomplish this, simply use the following code snippet:
add_filter('uwp_get_field_placeholder', 'uwp_get_field_placeholder_cb', 10, 2);
function uwp_get_field_placeholder_cb($placeholder, $field){
if(isset($field) && isset( $field->form_type ) && $field->form_type == 'login' && $field->htmlvar_name == 'username' ){
$placeholder = __( "Email", 'userswp' );
if ( isset( $field->is_required ) && ! empty( $field->is_required ) ) {
$placeholder .= ' *';
}
}
return $placeholder;
}
We recommend using the Code Snippets plugin to add snippets to your site.
In case the above code does not work, try deleting your site’s cache. That will ensure that the page loads afresh and the code snippet will start working.