If you allow custom fields on your WordPress site, chances are you need to gather some more information about your customers or end-users. If you absolutely need some specific information, the best way to get it is to add it during wp-login, otherwise, there are narrow chances that your users will actually visit their profile page and provide that optional data.
Sure, there are more number of free and premium plugins that are already exist, but you may want to do it manually, either because the plugins don’t do accurately what you want, or because you want to keep your website as lightweight as much as possible. Yes, there are tutorials also that tell you how to do it, but my analysis tells me that they are incomplete. in this tutorial we are going to explain how to add extra authentication field in WordPress login page.
Let’s get started :
add_action('login_form','my_added_login_field'); function my_added_login_field(){ //Output your HTML ?> <p> <label for="my_extra_field">My extra field<br> <input type="text" size="20" class="input" name="my_extra_field_name"></label> </p> <?php }
Paste the above code in active theme’s Functions.php or if you have Wp-snippets plugin you can create new snippet and add the above codes. After doing these changes goto wp-admin, you can see the changes.
If you have doubts or any conflicts please let us know by dropping your comment in the below comment box.
Happy Coding 🙂
Add Comment