I want to implement a custom login module inside wordpress. In the home page, I have this form where the users could register and another form where the users can login to the website.
Is it a better Idea to write custom code inside wordpress to accomplish my goal?
What other alternative do you suggest to it ?
you might be interested in a blog post about building a customized login form, I recently wrote.
It describes how to include a custom login form in any template, how to change the custom output and how to handle redirects after successfull/failed/empty login.
The WordPress-API functions/hooks involved are:
wp_login_form, authenticate and wp_login_failed
Nothing is wrong with writing custom code if you need something specific to happen when a user logs in. Other than writing custom code also is that you could just get an already built plugin!
You can use this code to create a WordPress login form on any page.
Writing custom code for WordPress is a very common thing. It almost what’s expected. Otherwise, you also have many themes and plugins where other people have written code you can use in your own WordPress site.
WordPress also has a internal way to Register new users:
If you enable this option under
Settings > General
, then your login page would have an option to register new users.Otherwise, if you want to write your own login code, you can start reading around the WP docs, for example in the internal function
register_new_user
.Unless you are creating something complex or special, you can stick to the built-in registration, and also customize with with HTML & CSS as you wish.