Question: how to create registration form in wordpress without plugin?Most web developers using WordPress but they do not like to their members or users to registration or login through the WordPress default register(signup)/login page .If you would like to make your custom login and registration page in WordPress any theme also you can use wpforms registration form.
Today I will learn to you how to make a a pop up WordPress custom login(signIn) and register(SignUp) page template without a plugin in WordPress.There are many good benefits to creating a new user custom login and register form on your CMS (Content management system) WordPress website.
Create Custom WP Forms
registration form that includes the bellow fields:
- Username
- First Name
- Last Name
- Password
Create Custom Register Page Template
Here first of all I am making a new php Based wordpress template file name is a custom-register.php as well as there place it inside your Page navigation: WordPress theme folder https://www.google.com/wp-content/themes/great-theme-name/
Check if the user is not logged in
We must first of all verify or check whether the current active user is logged in or not. I will display the registration(signUp) form only if the active current user is not logged in.
Create Registration Form
and then simple wordpress frontend login form code copy paste your source code for create a registration page on this template.
Create your account
PHP Source Code For Validation & Create Account
Now, You can submit and save your form with Full Validation following the source code.
} if ( 6 > strlen( $membername ) ) { $reg_errors->add('username_length', 'Member Name too short. At least 6 characters is required' ); } if ( username_exists( $membername ) ) { $reg_errors->add('user_name', 'The membername you entered already exists!'); } if ( ! validate_username( $membername ) ) { $reg_errors->add( 'username_invalid', 'The membername you entered is not valid!' ); } if ( !is_email( $memberemail ) ) { $reg_errors->add( 'email_invalid', 'Member Email id is not valid!' ); } if ( email_exists( $memberemail ) ) { $reg_errors->add( 'email', 'Member Email Already exist!' ); } if ( 6 > strlen( $password ) ) { $reg_errors->add( 'password', 'Member Password length must be greater than 6!' ); } if (is_wp_error( $reg_errors )) { foreach ( $reg_errors->get_error_messages() as $error ) { $registrationErrMessage='ERROR: '.$error . '
'; } } if ( 1 > count( $reg_errors->get_error_messages() ) ) { //simple sanitize member form input global $membername, $memberemail; $membername = sanitize_user( $_POST['membername'] ); $memberemail = sanitize_email( $_POST['memberemail'] ); $password = esc_attr( $_POST['password'] ); $memberdata = array( 'user_login' => $membername, 'user_email' => $memberemail, 'user_pass' => $password, ); $member = wp_insert_user( $memberdata ); } } ?>
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about create registration form in WordPress without plugin.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.