Step by step to create WordPress Custom Login Page Without Using a Plugin – Right Way in easy steps
Online Web Tutor Online Web Tutor
25.3K subscribers
50,753 views
625

 Published On Jan 20, 2018

WordPress is one of the most widely use Blog Engine today and many web developers are using WordPress
as CMS to build Blog, Personal and Business site, on past few days, I was working on a WordPress
site that needs Custom Login page functionality, you may see a lot of plugins out there to create
WordPress login page but this tutorial might helpful to all web developer who interested to learn in
WordPress.

#WordpressTutorialsPoint
#WordpressLearnersHub
#WordpressCustomizations
#LearnWordpressStepbyStep
#WordpressBySanjay

In this tutorial, I will explain how to make a WordPress custom login page without using any plugin.

Steps to make custom login page
===========
1. Make a Wordpress page

2. Make a template in theme's folder

3. Assign created template to Wordpress page.

4. Do code of login on Template file

5. Need to change some redirect urls after logout or for wp-admin

PHP code
================
This contains php script to validate and accept posted data from our HTML form.

global $wpdb;

$err = '';
$success = '';

if(isset($_POST['task']) && $_POST['task'] == 'login' )
{
//We shall SQL escape all inputs to avoid sql injection.
$username = $wpdb-]escape($_POST['log']);
$password = $wpdb-]escape($_POST['pwd']);
$remember = $wpdb-]escape($_POST['remember']);


if( $username == "" || $password == "" ) {
$err = 'Please don\'t leave the required field.';
} else {
$user_data = array();
$user_data['user_login'] = $username;
$user_data['user_password'] = $password;
$user_data['remember'] = $remember;
$user = wp_signon( $user_data, false );

if ( is_wp_error($user) ) {
$err = $user-]get_error_message();
exit();
} else {
wp_set_current_user( $user-]ID, $username );
do_action('set_current_user');

echo '[script type="text/javascript"]window.location='. get_bloginfo('url') .'[/script]';
exit();
}
}
}

Confused
============
Okay, let me explain further the lists of WordPress function we’re using.

is_wp_error: this will check whether variable is a WordPress Error.
wp_set_current_user: We use this wordpress built in function because many user report when using
wp_signon() function logs a user in but for some reason the global user variables such as $current_user
and $user_ID are not populated until the page is refreshed and calling get_currentuserinfo() doesn’t
populate as well. The is_user_logged_in() function also returns false.

Important Videos to watch:
Customize Wordpress Login Page:    • Step by step to Change WordPress Logi...  
Wordpress Widget development in 1 video:    • Complete tutorial for Widget Developm...  

SOCIAL :
===============
Subscribe :    / @onlinewebtutor  
FACEBOOK :   / onlinewebtutorhub  
TWITTER:   / owthub  
BLOG: https://onlinewebtutorhub.blogspot.in/

Also you can learn Wordpress Custom
===============
Wordpress Theme Development: https://goo.gl/MZ8maF

Wordpress Widget Development: https://goo.gl/Dc2htn

Wordpress Plugin Development: https://goo.gl/BA7dYG

Wordpress Theme Options Development: https://goo.gl/Vjv3Ub

Learn backbone.js here! : https://goo.gl/Qd2Pcs

Tags
===============
WordPress Custom Login Page,
customize wordpress login page without plugin,
How to Create a Custom Login Page for WordPress,
Build a Custom WordPress Login,
How to Build a Custom-Made WordPress Login Page,
wordpress custom login url,
step by step login page development in wordpress,
wordpress custom login page tutorial in easy steps,
wordpress custom login page,
customize wordpress login page without plugin,,
wordpress custom login form,
wordpress custom login form code,
online web tutor,
profotech solutions,

Thanks
Online Web Tutor
Keep learning and Sharing :)

show more

Share/Embed