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
- Is there a plugin or resource for custom implementation for OAUTH and regular user login?
- need to find duplicated meta value in custom filed and view the posts that have the same value
- Create a pdf from the entries in DB
- Help with autofilling field
- how to find out which plugin disable custom field for post
- Preset custom fields
- What database state changes happen after a post is manually “updated” with no changes?
- Register PODS Custom Field with WPGraphQL [closed]
- get_post_meta shortcode returns empty field
- Can we hide a certain user in WP?
- Changing the Default New User Notification Email
- custom fields not displaying on wordpress site
- How to add Mobile field in Registration form using Theme my login Plugin
- WordPress hide post from custom post-type on a single page
- How to implement data residency in my WordPress site
- Create multiple posts when a custom post is created
- how to create user profile pages and display them based on users roles
- Why Custom fields description is not working WordPress Version 5.4.2?
- Adding Custom Endpoint in WordPress Rest API
- Clean old users
- General Term for this form Field
- After reading 3 story by user ask for subscription popup
- How do I change the functionality of an image slider which is part of ACF?
- Make custom post types using ACF
- User updating their profile wipes my custom fields
- Problem Advanced Custom Fields PRO
- Comment restrictions Wodpress
- How to pass multiple custom fields as shortcode’s parameters
- How To Export User’s Custom Fields in CSV or XLSX
- Meta Key array building with multiple input values from fields
- On button click, redirect users to registration page instead of another page
- How do I run my custom function in my plugin when a wordpress user is deleted?
- Custom product page’s style for printing
- Custom plugin issue – Notice: Trying to get property of non-object in
- How can I store user preferences in WordPress and retreive them later?
- Simulate Update User button click
- If I am not writing a theme, how do I add custom fields to a user for a plugin
- Saving data only when payment is successful
- Create password protected page, no registration
- Update User Meta Via Ajax
- User Following System
- Taxonomy question
- How to see in Edit Comments if comment is from User and her Roles
- How to get post that has non zero or greater than zero meta value
- How can I call functions from a custom plugin?
- Creating Nested custom fields
- Custom User Notice Upon Login
- Problem with conditional woocommerce custom checkout field
- Create Biographies
- How can I save cookies to members
- Paid Memberships Pro, Display User Limit
- WordPress doesn’t save a post revision when changing CMB2 custom fields
- Overwrite user role
- Do something with thumbnail image on post publish
- Confusing problem with displaying message recipient metadata
- Every time I use wp_get_current_user() my plugin breaks
- Custom Widget not Available after Plugin Installation
- How to add wordpress plugins in along with my standalone theme
- How to order users alphabetically by name? in plugin UPME
- Add custom field for users
- 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
- Add new post using a page inside the website
- Defined user role to access plugin’s pages
- Need help getting a certain value out of a multi dimensional array
- Creating a user ‘add custom field’ section
- How set role at registration based on email?
- Private WordPress blog, requires user registration approval, and allowing users to login with OpenID
- How change menu for each user in plugin?
- How to set different users for different pages?
- What method should I use for a sidebar widget that reads latest posts?
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- WordPress Meta Query: Relation is not working correctly
- Plugin De/Activation Not Firing On MultiSite install
- Convert usernames listed by the Groups plugin shortcode to displayed names?
- How can i do custom author list?
- Displaying custom profile fields using Mingle Plugin
- force category table refresh when adding new category
- Is there a way to add a custom input field for every taxonomy term in WP post editor?
- What plugin(s) are best for this User registration task? [closed]
- Buddypress Plugin for register user from other site’s [closed]
- Advanced Custom Fields Plugin – not displaying images
- custom registration form [duplicate]
- I want to remove the register/login WordPress top bar from my website
- Want to add post to user dashboard