Custom login form for WordPress

How to create custom login form for your WordPress site where (optionally) only specific user roles are allowed to login.

This article explains how to setup and configure your custom Login form for WordPress. In most use cases a login form will work in combination with a registration and lost password form so you might also be interested on how setup a Registration form and or Lost password form.

A demo form is available under Super Forms > Demos named "Login form" which should help to quickly get a working Login form up and running.

Creating a custom WordPress login form

Important: Your login form must have fields named exactly user_login and a password field named exactly user_pass. These are required for WordPress login to function properly. You are also strongly advised to not store or save the password field since for most use cases this is not desired. However Super Forms does give you the ability to do so. So please double check that your password field is not saved as Contact Entry data, and that you are excluding it from E-mails.

First edit your form and navigate to Form Settings > Register & Login. From the Actions option choose Login (user will be logged in). Now when the form is being submitted it will try to login the user.

Allowing only specific user roles to login to your WordPress site

Now select the roles that should be allowed to login, or leave black to allow all roles.

Defining the login page URL

Make sure to define the Login page URL so that it points to the URL where the Login form is located, for instance: as shown in the image below. This URL can be retrieved with the tag {register_login_url} inside your E-mails if needed.

Verification of E-mail address

If your registration form is configured to send a verification E-mail after registering a new account, you will want to make sure you add the Verification Code element to your Login form.

Whenever the user clicks the verification link inside the E-mail, they will be redirected to the defined login page where they can enter the verification code to activate their account. As shown below.

You should now have a working login form which allows user to login to your WordPress site. Now might be a good time to read how to setup a registration form and or lost password form.

Last updated