Set “Display name publicly as” to be usernames by default

If you want this for all future users then hook into the user_register event and update it there. Pull the WP_User using get_userdata and wp_update_user info with the new display name. add_action( ‘user_register’, ‘wpse_20160110_user_register’, 10, 1 ); function wpse_20160110_user_register ( $user_id ) { // get the user data $user_info = get_userdata( $user_id ); // pick … Read more

WordPress User Name Limitations

I think the answer is in the source. $username = wp_strip_all_tags( $username ); $username = remove_accents( $username ); // Kill octets $username = preg_replace( ‘|%([a-fA-F0-9][a-fA-F0-9])|’, ”, $username ); $username = preg_replace( ‘/&.+?;/’, ”, $username ); // Kill entities // If strict, reduce to ASCII for max portability. if ( $strict ) $username = preg_replace( ‘|[^a-z0-9 … Read more

Email as Username in registration

You can use @ and . in usernames, so there is no problem. Now you could create your own register form and use register_new_user(). You could even manipulate wp_registration_url() with the filter register_url, so the register link would point to your new register page. If you want to use it with the standard interface provided … Read more

Change user’s display name programmatically

Just pasted your code into my functions.php with a different ID and checked the user’s page in /wp-admin/user-edit.php – it works, the value in Display name publicly as field is updated. Most likely something is wrong with your output on the user page. Check your template file. Or, if you can’t find the problem, edit … Read more

How can i force Display names to be the same as Usernames?

You can use the wp_pre_insert_user_data filter. function wpse_filter_user_data( $data, $update, $id) { if( isset( $data[ ‘user_login’ ] ) ) { $data[ ‘display_name’ ] = $data[ ‘user_login’ ]; return $data; } $user = get_user_by( ’email’, $data[ ‘user_email’ ] ); $data[ ‘display_name’ ] = $user->user_login; return $data; } add_filter( ‘wp_pre_insert_user_data’, ‘wpse_filter_user_data’, 10, 3 ); You’ll probably want … Read more

Why can’t I update username through WordPress API?

Looking on Trac I found a ticket that discusses exactly this issue: Administrator should be able to change usernames This is what it all boils down to: Changing usernames could break permalinks To prevent this a lot more than just changing the username in the DB would need to be done. E.g. redirection from old … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)