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 to use Javascript and/or CSS to hide the field too for a better user experience.
$( '.user-display-name-wrap' ).remove();
.user-display-name-wrap {
display:none;
}
Related Posts:
- Upload files programmatically to users
- How to create custom LOGIN and REGISTRATION forms?
- Will WordPress username displayed somewhere in the site?
- Average Account Age
- WordPress Central User Database
- wp_set_auth_cookie causes 403 error in the wooCommerce checkout
- Custom User meta field display
- How to create multiple users at once?
- Auto populate a user custom field from another user custom field
- Get all user meta_keys and then group users by matching values
- Searchable Semi Random Number Generator on User Profiles
- User / membership Plugin [closed]
- Users Ultra: Hide asterisk for required registration fields?
- User register hook can’t access form request
- Issues with creating user profile for a subscriber, but with different profile page and functionalities
- Override WordPress user with Oauth2 account
- Problem with Hebrew characters in username
- Loading posts associated only to the logged in user on recent posts page
- Adding Custom Fields for Img in Posts
- Removing user contact methods works from functions.php but not from a plugin
- How can I let users to access plugin functions based on roles?
- Get User ID from within a plugin
- Is it possible to block subscriber users to changing its password?
- delete_user_meta Delete one value out of array
- What plugin should I use for a basic user signup/login system [closed]
- add_meta_box Callback not being called
- Is there any good tutorial to write custom login, registration and password recovery forms? [closed]
- Mass Import Users without sending new user notification
- Displaying a Welcome Message to a Woocommerce User
- Last modified field for user profile?
- Add More Fields to Users Pages (Admin Panel)
- Two people sharing user in WordPress [closed]
- FacetWP group listings by custom field [closed]
- how do i remove posts from a WP_Query so the pagination is right?
- Form doesn’t submit on second submit call
- How to get current post user id
- How to read individual user’s directory and display content to that specific user?
- How can I change the meta_key for a particular piece of information?
- Execute js files doesn’t seem to work
- Users are being redirected to main site when trying to register on subsite of my Multisite network
- WordPress metaboxes – textfield suggestion automatically populated
- Char limit on custom blog-post form? [closed]
- Preventing My Plugin From Being Used For Free
- How do I enforce users to fill a determined custom field using WyPiekacz?
- easy steps to make front end form without plugin
- Understanding State in WordPress Multisites
- Add Content to Content()
- Is there a plugin for WordPress for creating ‘Accounts’ where all users who belong to that Account can only see Account data? [closed]
- Add User Role: Pre-saved in User-Meta [SOLVED]
- Order posts by meta key ( Using ACF )
- How to add fields in the WordPress editor?
- How limit user connection?
- WordPress function to add text warning on every pages [closed]
- WordPress /users/me endpoint request forbidden
- How to find the Registration page
- Price comparison table based on Custom Post Type?
- wp_logout_url($redirect); is not working in wordpress
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- Woocommerce – Change Variable Product Add to Cart to behave like external product using Custom Field (link) [closed]
- Plugin permissions for Editor role
- Structuring function with registration_errors hook
- Role based permission edit for plugins
- “After file loaded” action
- Plugin privelages for “editors”
- Shortcode not displaying HTML within the function
- Janrain/Simple Modal under Redirected Domain
- How to create repeater field manually, without plugin (ACF Pro)?
- Best approach to make all tags searchable by the wordpress search function
- Preset custom fields
- Can we hide a certain user in WP?
- WordPress hide post from custom post-type on a single page
- Why Custom fields description is not working WordPress Version 5.4.2?
- After reading 3 story by user ask for subscription popup
- Problem Advanced Custom Fields PRO
- How do I run my custom function in my plugin when a wordpress user is deleted?
- Custom product page’s style for printing
- Create password protected page, no registration
- How to get post that has non zero or greater than zero meta value
- Creating Nested custom fields
- Custom User Notice Upon Login
- Create Biographies
- WordPress doesn’t save a post revision when changing CMB2 custom fields
- How to add wordpress plugins in along with my standalone theme
- How to order users alphabetically by name? in plugin UPME
- How to Save settings of custom tab product page in admin side in a database?
- Changing the body of mail sent to new user registration
- How change menu for each user in plugin?
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- Convert usernames listed by the Groups plugin shortcode to displayed names?
- Displaying custom profile fields using Mingle Plugin
- Is there a way to add a custom input field for every taxonomy term in WP post editor?
- custom registration form [duplicate]
- I want to remove the register/login WordPress top bar from my website
- Woocommerce custom fields
- A plugin for software reviews site like this one?
- WordPress User Portal
- Need a Plugin to create a registration form for my website? [closed]
- Create Unique and Customized User ID for Website Members in WordPress
- Share or sync user table data with another user table
- WordPress isn’t sending welcome email with the password reset