Change default display name in WordPress

WordPress is one of the most popular CMS (Content Management System) used by so many big companies and professionals but sometimes with default settings, the site is open for hackers through which the number of attacking chances are more if you use default configuration.

Also Read: Change Default WordPress Table Prefix Name (Before and After Installation)

By default, username is set as a display name which can be seen in author URL and posts page. Using the username as a display name is something useful for hackers and spammers because it can be further exploited with some bruteforce attacks.

To change that, you need to edit your User’s profile page and change the default Display name from “username” to “First Name Last Name” format as shown in below screen.

Suppose you’ve a open registration page and you want to change the default display name to full name, then you can embed the following code in your theme’s functions.php file. (Pastebin Link)

function change_display_name( $user_id ) {
$info = get_userdata( $user_id );
$args = array(
‘ID’ => $user_id,
‘display_name’ => $info->first_name . ‘ ‘ . $info->last_name
);
wp_update_user( $args );
}
add_action(‘user_register’,’change_display_name’);

Once the above code is added in your theme’s functions.php file then try to create a new user and you should see “First Name Last Name” as a display name as shown below:

You may also like:

Sarcastic Writer

Step by step hacking tutorials about wireless cracking, kali linux, metasploit, ethical hacking, seo tips and tricks, malware analysis and scanning.

Related Posts