Register Users on the Website
Learn to let users become subscribers of the website.
We will set up the registration option to let anyone come and sign up for an account with our website. The users who sign up for accounts will become subscribers. Subscriber role has no permissions. We can give them access to features that will not hurt the security of the website (like registering for courses or liking a post).
Allow users to register
Open the admin dashboard sidebar. From the "Settings" option, visit the "General Settings" screen. Here we can see a "Membership" option with a checkbox to allow anyone to register. The next option "New User Default Role" lets us choose the permissions for the user who registers. We will choose the "Subscriber" option because this role does not give any permissions to edit the website. Subscribers do not pose a security risk for the website. Click "Save Changes" at the bottom of the screen.
WordPress Sign Up form
On the homepage of the website, we can see a "Sign Up" button at the top right of the page. Right now this button does not work.
WordPress has a built-in registration form which can be seen by adding /wp-signup.php at the end of the root URL. This link leads us to a registration form with a username and email. We want this page to open up when the user clicks the "Sign Up" button on the header.
Open header.php
. Locate the code for the button that says Sign Up. For the href
value, we will provide the link to the WordPress sign up page by calling the site_url()
function as follows:
Get hands-on with 1200+ tech skills courses.