How to Change the Username Placeholder on Login Forms?

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 free WP 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. 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.