WordPress User Registration Without Username Requirement

Are you looking to enable user registration on your WordPress website without requiring users to enter a username when filling out the registration form?

When it comes to creating a user-friendly experience on your WordPress website, simplicity is essential. However, one common obstacle users face during registration is the requirement to enter a username. While usernames distinguish one user from another, they can also be a source of friction, leading to abandoned registrations and frustrated users.

We’ve received some customer requests asking if creating a WordPress registration form without requiring a username is possible. Technically, WordPress requires usernames for all users. However, there’s no need to worry—we have a solution.

In this tutorial, I’ll guide you through creating a WordPress registration form without a username field that works.

Why Remove the Username Field from WordPress Registration Form?

Here are some reasons why removing the username field from the registration form of your WordPress website can be beneficial.

Simplified Registration: Eliminating the need for a username speeds up the registration process. With fewer fields to fill out, users are more likely to complete the registration process without hesitation.

Increased User Engagement: Requiring users to come up with a unique username can be a barrier to entry, especially for those who may struggle to think of something original. By removing this requirement, you lower the barrier to entry and encourage more users to sign up and engage with your website.

Implementing WordPress User Registration Without a Username

Now that we understand the benefits of removing the username requirement let’s explore how to implement this on your WordPress website using ProfilePress Plugin.

Building the Registration Form

Access the edit screen of your ProfilePress registration form by clicking on its title in the WordPress backend.

Then, remove the username block or shortcode (if using the advanced form builder).

Next, go to the form settings and select the ‘Disable Username Requirement’ checkbox.

With these steps completed, users signing up via the registration form will automatically have a username generated from their email address.

For instance, if a user registers with the email address [email protected], their username will automatically be set as ‘johndoe’. If the username already exists, it will be modified to ‘johndoe1’.

Memories powered registration form

Modifying Registration Errors

Note: all code snippets in this post should go into your theme’s functions.php file or a site-specific plugin.

Below are the username-generated error messages of a WordPress registration form.

  • Username may not be longer than 60 characters.
  • Sorry, that username already exists!
  • Sorry, that username is not allowed.

The code below replaces “username” in these error messages with “email address”.

add_filter( 'gettext', 'change_registration_username_errors', 10, 3 );
function change_registration_username_errors( $translations, $text, $domain ) {
	if ( $domain == 'default' ) {

		if ( $text == 'Username may not be longer than 60 characters.' ) {
			$translations = 'Email address may not be longer than 60 characters.';
		} elseif ( $text == 'Sorry, that username already exists!' ) {
			$translations = 'Sorry, that email address already exists!';
		} elseif ( $text == 'Sorry, that username is not allowed.' ) {
			$translations = 'Sorry, that email address is not allowed.';
		}
	}

	return $translations;
}

Modifying Login Errors

We should be done by now, but we still need to modify username-generated errors in the WordPress login form to make it foolproof.

The code below does that excellently well.

add_filter( 'gettext', 'change_login_username_errors', 10, 3 );
function change_login_username_errors( $translations, $text, $domain ) {
	if ( $domain == 'default' ) {

		if ( $text == '<strong>ERROR</strong>: Invalid username.' ) {
			$translations = '<strong>ERROR</strong>: Invalid email.';
		} elseif ( $text == '<strong>ERROR</strong>: The password you entered for the username %s is incorrect.' ) {
			$translations = '<strong>ERROR</strong>: The password you entered for the email address %s is incorrect.';
		} elseif ( $text == '<strong>ERROR</strong>: The username field is empty.' ) {
			$translations = '<strong>ERROR</strong>: The email field is empty.';
		} elseif ( $text == '<strong>ERROR</strong>: Invalid username or incorrect password.' ) {
			$translations = '<strong>ERROR</strong>: Invalid email address or incorrect password.';
		}
	}

	return $translations;
}

Conclusion

Opting for WordPress user registration without the necessity for a username can significantly enhance the registration experience for website users. By simplifying the process and removing the friction associated with selecting a username, you pave the way for smoother user onboarding and increased engagement.

Although WordPress typically mandates usernames for all users, our tutorial has unveiled a workaround to streamline the registration form. With these insights, you now possess the knowledge to create a more user-friendly registration process.

See also: WordPress User Registration with Only Email Address.

Create Paid Membership Websites in Minutes

Install ProfilePress today and get a modern and powerful WordPress membership & ecommerce website – the easy way!