/**
* Set new user's display name as their login.
*
* @link http://wordpress.stackexchange.com/q/138034/1685
*
* @param int $user_id
*/
function wpse_138034_display_name_as_login( $user_id ) {
if ( $user = get_user_by( 'id', $user_id ) ) {
// Prevent infinite loop.
remove_action( 'user_register', __function__ );
wp_update_user(
array(
'ID' => $user_id,
'display_name' => $user->user_login,
)
);
// All done, restore.
add_action( 'user_register', __function__ );
}
}
add_action( 'user_register', 'wpse_138034_display_name_as_login' );
Related Posts:
- buddypress remove username from autocomplete
- How can I apply custom sanitization to new usernames?
- How to use same username account for multiple users?
- Is there a flowchart for WordPress loading sequence?
- How do register_sidebar() and get_sidebar() work together?
- Is it possible to change the attributes of a registered style or script before it fires?
- how to change “published date” format on edit.php (Posts page)?
- Custom category order with get_categories
- How to change submit button value in comment from “Post Comment” to “Send”
- Pagination Help on Crazy Custom Authors Page
- Getting rid of the #038; when string replacing content
- Querying multiple WordPress custom fields with AND qualifier
- WordPress custom post types breaks permalink on theme reinstall
- Creating a searchable A-Z listing of hundreds of companies/services
- Show attribute description when filtering by that attribute
- Create a Custom menu item fetched by Product Categories and Sub Categories
- Customize in category page
- Multi-Site Plugin Activated (Not Network-Activated), What Happens?
- Add custom column to Users admin panel with Types user custom fields?
- How do I change the default admin color scheme in MP6
- woocommerce Add custom field set like billing fields
- Adding action to save_post, post needs to be saved twice for function to work
- Calling a php file from a javascript file in wordpress
- 1 bit audio player
- Outputting posts from post id´s in variable
- Auto redirect after session expire, but only for one user
- Theme licensing and permission on changing content [closed]
- Add ‘Creator’ User Meta when adding user
- Auto login after wordpress installation
- Custom title, Bones theme
- Determining What Content Gets Displayed
- Truncating varying lengths of information
- How to get pages id in array in get_pages?
- Access post meta in future_to_publish function
- Javascript Solution Remove Specific Tag but leave the rest in a specific DIV
- How to create a completely private wordpress with multiple membership levels
- Why do posts disappear from admin after upgrading from WP 2.7.1 to 3.0.1?
- woocommerce_checkout_fields modifying existing billing_phone label created new field
- How to change the category url jusy show /category/%category_id% in wordpress?
- custom meta box for page default template
- Child Theme with multiple css files
- How to host 2 subdomains as lookalike destinations under one master domain?
- “An automated WordPress update has failed to complete – please attempt the update again now”– But there is no .maintenance file
- How do I redirect a post url to a custom url?
- Custom Login Process
- How could I verify whole WP directory before/after working with a freelancer? [closed]
- How to customize
- Modify files without losing customization after updates
- Determine if action was executed in functions
- Semi complicated custom taxonomy question
- Archive subtitles for different types of archives
- Point homepage to custom php page
- Duplicated content with custom shortcode
- Display a list of subcategories (from specific Category) a post belongs to
- Implement a Walker with custom object rather than WordPress database object
- Adding tags when creating new post
- How can I tag a menu item as visited for each unique user?
- Custom Content Page
- Add Member’s birthdate from Backend and shows it on frontside [closed]
- How to add functionality to an existing theme (using child themes)
- How to Render Post Types in RSS Feed?
- How do I fix my static page
- URL and Site title outputting on Login page
- 404 when Previewing an unsaved draft
- List of contents of entire blog
- Display a specified content on a Page and all its child pages
- Custom field not editable by the user
- WordPress category custom title
- How do I make mysite.com/comingsoon WordPress to become my main website’s WordPress?
- Use a custom page with dynamic content as a user profile page
- adding fade on mouseover to images
- Customize section does not show my widget areas
- Invitation link to a site in multisite network does not work?
- Add helper text in custom-header section in admin
- How to edit content in code view of home page when there is some theme applied?
- How to display strikethrough text in button text (for special offer)
- Remove Title and White Space in Twenty Twenty theme
- Lightbox not showing image caption
- WordPress core jquery version file not loaded?
- Can we add an extra button on woocommerce shop page and use it to send the product info including image in a mail?
- WP_User_Query Search Multiple Keywords from a Multi-Select Field?
- Add a custom intro page
- clickable toggle menu, help
- How to change custom link of subpages from of localhost to website
- twenty seventeen customizer duplicates section content
- Custom login doesn’t stay
- How to append the excerpt to the content in the single post page?
- How to Password Protect whole site except for some subdirectories
- Custom dropdown search form that allows users to select option B based from Option 1
- Ordering a specific post type
- Header image doesn’t show up on page
- How to get name and email value from a custom form and add it to campaign monitor subscriber list?
- Custom Link In WordPress Media “Attachment Details” Upload Screen
- “Static” pages within a theme
- Assign classes to Custom fields
- Custom WordPress SQL Query 4 posts per custom taxonomy
- Prevent posts from being published if the ‘Uncategorized’-category or no category is selected
- I need to make the title of the page dynamic in my custom plugin
- Custom CSS working on home page but not on NEW created PAGE
- Custom Menu (only showing direct cildren) ACF not showing