Skip to content
wp knowledge hub logo white
  • Home
  • WP Knowledge Hub
  • Resources
    • Infographics
    • WordPress Training
  • News & Articles
wp knowledge hub logo white
  • Home
  • WP Knowledge Hub
  • Resources
    • Infographics
    • WordPress Training
  • News & Articles
custom-login-wordpress

Allow WordPress User Registration with Custom Login Page

Code Snippets, Plugins, Tutorials / Login, Registration

Last Updated on May 14, 2022 by WP Knowledge Hub

How to Allow Users to Register on Your WordPress Website

Are you looking for a way to allow users to register on your WordPress website? We have two brilliant solutions for you!

You can easily enable user registration in WordPress to allow users to sign-up to your blog, get access to special content, or even become content contributors.

Enabling User Registration in WordPress Settings

WordPress has built-in functionality to allow new users to register themselves. By default, it’s not activated, so in order to turn it on, you need to go to Settings > General >then scroll down to Membership and tick the checkbox that says ‘Anyone can register’ .

It’s important to understand the difference between a subscriber and an administrator. An admin is someone who has total control over the site, so make sure NEVER to set “Administrator” as the default user role.

Once you’ve activated this setting, your WordPress website is now open to new user registrations. If you go to the default WordPress login page, you’ll see an option to register now.

Creating a Login and Registration Page

Although users can technically use the default WordPress login page to register now, this poses a bit of an issue:

A) You don’t want users to have to manually type in /wp-admin at the end of your URL to register. This is bad user experience (UX).

B) The WordPress default login/register form is not very pretty, and looks the same on every WordPress website, and that takes away from your theme’s branding.

Before allowing anyone to register on your WordPress website, you’ll want to create a custom login and registration page. But how do you do that?

Well, there are two ways. Using a plugin, or creating them yourself writing a bit of code in the functions.php file.

Using the Theme My Login Plugin

The Theme My Login plugin is one of the, if not the most popular custom login and registration solution available for in the WordPress free plugin repository.

Simply go to Plugins > Add New > and search for Theme My Login, and choose the one with the little chameleon logo. Install it and Activate it and you will notice the new Theme My Login tab in your WordPress dashboard sidebar.

When you click on it, you’ll want to allow users to set their own passwords, and you’ll want to take note of the slugs (URLs) of each important auto-generated plugin page:

Simply add /login/ or /register/ at the end of your URL to test the new page’s functionality.

Once everything is working correctly, you can go to Appearance > Menus > your primary menu, and add the necessary page to your navigation structure to allow users to access the pages directly.

Using the Functions.php to Create a Custom Login and Registration

If you’re more of a hands-on person and you want to practice your coding skills, this alternative is for you. You can replicate the WordPress login form with a function and a shortcode.

Before WordPress introduced the wp_login_form() function, creating a login form on a page was a long and hard process.

Since then, this function allows you to easily display the WordPress login form on any page or post.

The first thing you’ll need to do is access your functions.php file, either through the WordPress dashboard by going to Appearance > Theme File Editor > functions.php, or using an FTP client, like FileZilla.

It’s safer to use an FTP client, because screwing up the functions.php file will cause your website to crash, and if that happens, you need a way to restore the old version of the functions.php file. So, having a backup on your local computer definitely helps!

Creating Your Login Form Shortcode

Once you have the functions.php file open, you’ll want to add this code:

add_action( 'init', 'my_add_shortcodes' );

function my_add_shortcodes() {

	add_shortcode( 'my-login-form', 'my_login_form_shortcode' );
}

The code above creates the function that creates the shortcode. Next you’ll want to verify that the user is not already logged in before it calls the wp_login_form() function:

function my_login_form_shortcode() {

	if ( is_user_logged_in() )
		return '';

	return wp_login_form( array( 'echo' => false ) );
}

After adding these lines to the functions.php, you can safely add the new shortcode below to any page or post:

[my-login-form]

Is Opening the WordPress Registration to Anyone Safe?

Before you commit to opening WordPress’ registration to anyone, you should know there are some risks involved. You will be opening the door to countless spammers who will make your life hell unless you deal with the problem beforehand.

You will want to add a CAPTCHA to your registration form, or add the appropriate anti-spam plugin before you do!

That’s it!

Post navigation
← Previous Post
Next Post →

Related Posts

events-calendar wordpress

How to Add Events with Events Calendar in WordPress

Plugins, Tutorials / Calendar, Events
wordpress custom post type

How to Add Custom Post Types in WordPress

Plugins, Tutorials / CPT, CPT UI, Custom Post Type
translate content with wpml

How to Translate Content in WordPress with WPML

Plugins, Translation, Tutorials / Multilingual, WPML
wordpress svg tutorial

How to Add SVGs in WordPress

Design, Security, Tutorials / functions.php, Media Library, SVG

Search the WP Knowledge Hub

General Categories

  • Code Snippets (5)
  • Design (5)
  • Hosting (13)
  • Optimization (9)
  • Plugins (17)
  • Security (6)
  • SEO (4)
  • Translation (3)
  • Troubleshooting (18)
  • Tutorials (31)
  • WooCommerce (4)

Popular Keywords

Analytics API Caching CDN Checkout Client Portal Cloudflare Content Elementor FTP Gravatar Guttenberg hack Hacking htaccess Installatron Invoice Payment Login Mailchimp malware Memberships Migration Name Your Price Paid Memberships Pro Permalinks PHP phpMyAdmin popups Product Add-ons Products Profiles Really Simple SSL Registration Search Console Speed SSL String Translation Templates Updates Users Videos Wordfence WPBakery wpconfig WPML

A Huge WordPress Resource Center of Tutorials and Solutions for Common Development Issues

Read through all the WordPress tutorials and code snippet solutions for everyday, common WP issues, or use the search and filter options to find exactly what you're looking for!

WP Knowledge Hub

Copyright © 2022 WP Knowledge Hub

Powered by NOBL Web.

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT