How to create a custom register form in wordpress?

Yes, We can Create a Custom register form without using any plugin.
Below i will tell you step by step Example in details that i have already implemented in a wordpress website.

First We need to Create a template for the register form:
Let say tmpl-register.php is our file name:

Now the form is ready. Please check for the id and proper classes.
In this form i am using the Jquery validation.

To use jquery you need to include the file jquery.validate.js. You can get this online by Search on google.
you can add the jquery in your footer.php file or any new js file.
I am using the validation in the footer.php file
First we need to include the file
<script src="<?php echo get_template_directory_uri(); ?>/js/jquery.validate.js"></script>

And the code for Validation:

In the Above code you will see the id and the classes used for the proper validation. And you can change and add the new messages as per your requirements.

Here you noticed i have given the url.
url: '<?php echo get_template_directory_uri(); ?>/template-parts/reg-ajax.php',

So the New file would be reg-ajax.php. This file is used for Insert the new user to the database.

Just follow the code you will understand.

File name: reg-ajax.php. As you see i have given in the url template-parts/reg-ajax.php. That means i have put this file in the template-parts folder into my theme folder. you can place it outside the folder as you want with changing of your path name.

reg-ajax.php

I have placed all three files in the template-parts folder. In this Twenty-sixteen theme used.

You can use in any theme. the code will work just use the proper id and remember to include the jquery as well.

You can add more fields and validation according to the requirements.

Enjoy..

Ankush chhabra

My name is Ankush Chhabra and I’m a 28 years old web developer and blogger.I have 5 years of experience in this field.