Home » WordPress » WordPress Front End User Login

WordPress Front End User Login

Many wordpress users like us want to make a front end login form for many purposes. So, today I am going to show you how to do that.

Step 1

First you have to create a page template . Here we will create a page template named “Login Page”. Though I assume you know how to create a page template, but I will give you the code. First, create a php file named “some-name.php” and paste the code in head section of the page.

<?php /** * Template Name: Login Page

* * @package WordPress

* @subpackage Shephard

* @since WordPress */ ?>


Now create a page like log in and select the page template for that.

Step 2

Now we have to create a form for user login.

For this purpose we will create a form and give it a proper style and look through css.

<form method="post" action="">

<div class="login-form">


<input name="review-user-name" type="text" class="request-field3" placeholder="user Name">



<input name="review-password" type="Password" class="request-field3" placeholder="Password">


<div align="center">

<input name="review-login-button" type="submit" class="sub-button6" value="Login">






Step 3

In this step we will submit the form and if the submission is successful we will redirect the user to the home page.


if( isset( $_POST['review-login-button'] ) ) {


$creds = array();

$creds['user_login'] = $_POST['review-user-name'];

$creds['user_password'] = $_POST['review-password'];

$creds['remember'] = true;

$user = wp_signon( $creds, false );

if ( is_wp_error($user) ) {

$error = $user->get_error_message();


else {

wp_redirect( home_url( '/home/' ) );





Step 4

If any error occurs then we will show the error message like the code below.


if( $error )


echo '<div class="error">'.$error.'</div>';




You can give proper styling to the HTML and make it look fancier.

Thus through this simple steps you can create  a better login form than WordPress have.

Here is a sample of mine just in case.

Hope this help you a little.


I picked PHP and JavaScript as a career start-up and developed a lot of applications using these. Like Management Application, Web Scrapping, Web API, E-Commerce Solutions, Finance Application etc. Outside of my professional life, I also do projects and code for reputation and my personal portfolio.

Leave a Reply

Your email address will not be published. Required fields are marked *