Today, you will learn how to create a custom login and register without a plugin in WordPress. There are so many different ways of customizing the WordPress login page and register page process. There are two functions that are very important for logging in and registering. The first method is to check the username and the password. If your username and password are wrong, then this method will show an error in your Browser; and the second method is to create new user information and save it into your WordPess database.
WordPress Function
- wp_signon – It helps to authenticate a user with the option to remember the credentials.
- wp_create_user – This function allows you to insert a new user into the WordPress database.
- $login_data = array();
- $login_data['user_login'] = $username;
- $login_data['user_password'] = $password;
- $login_data['remember'] = $remember;
- $user_verify = wp_signon( $login_data, false );
- <?php
- // Check username is present and not already in use
- $username = $wpdb->escape($_REQUEST['username']);
- if (strpos($username, ' ') !== false)
- {
- $errors['username'] = "Sorry, no spaces allowed in usernames";
- }
- if (emptyempty($username))
- {
- $errors['username'] = "Please enter a username";
- }
- elseif (username_exists($username))
- {
- $errors['username'] = "Username already exists, please try another";
- }
- // Check email address is present and valid
- $email = $wpdb->escape($_REQUEST['email']);
- if (!is_email($email))
- {
- $errors['email'] = "Please enter a valid email";
- }
- elseif (email_exists($email))
- {
- $errors['email'] = "This email address is already in use";
- }
- // Check password is valid
- if (0 === preg_match("/.{6,}/", $_POST['password']))
- {
- $errors['password'] = "Password must be at least six characters";
- }
- // Check password confirmation_matches
- if (0 !== strcmp($_POST['password'], $_POST['password_confirmation']))
- {
- $errors['password_confirmation'] = "Passwords do not match";
- }
- // Check terms of service is agreed to
- if ($_POST['terms'] != "Yes")
- {
- $errors['terms'] = "You must agree to Terms of Service";
- }
- if (0 === count($errors))
- {
- $password = $_POST['password'];
- $new_user_id = wp_create_user($username, $password, $email);
- // You could do all manner of other things here like send an email to the user, etc. I leave that to you.
- $success = 1;
- header('Location:' . get_bloginfo('url') . '/login/?success=1&u=' . $username);
- }
Let's start with the following steps.
Step 1: To create a template in WordrPess, Create PHP file like new –login.php.
Go to your active theme.
Open the active theme folder and save the PHP file which is created.

Open PHP file into PHP editor like Netbeans , Notepad++ etc.
Step 2: Open the file and write the template name, shown in the example, given below:


Save it.
Step 3: Go to WordPress admin panel and create WordPress pages.
Click Pages-> Add New.

Click publish.
Step 4: Open your pages in the Browser. Show login HTML in your pages.

Step 5: If you enter the wrong information, then it will display the error as follows:

On entering the correct information, the following screenshot will emerge:
Login Code display





Roshan RathodPosted Jul 30, 2020, 12:05 AM
Good one...
Rafael ChicaPosted Oct 4, 2018, 5:31 PM
Nice, but how make page profile no plugin. Thanks.
Santhakumar MunuswamyPosted Jun 25, 2016, 2:54 AM
Nice share
Vignesh ManiPosted Jun 17, 2016, 5:36 AM
Nice
Thiruppathi RPosted Jun 16, 2016, 1:00 AM
Nice one..
Bhushan SinghPosted Jun 16, 2016, 12:19 AM
thnks
RajaPosted Jun 16, 2016, 12:01 AM
Nice...