How to add extra field on WordPress Registration form

Can I add an extra field on WordPress Registration?

I got many e-mails from my clients and my users that how they can add an extra field to their default WordPress Registration form. Always my answer was YES. For me, WordPress is the most powerful user management system because it allows you to extend what it has 🙂

By depending on the extending facility of WordPress, I have added the extra field on the registration form. As all of the WordPress users does not have code knowledge for that reason, my blog always shows how to do few tricky and easy development without having much technical knowledge.

custom_reg

 

How to Add?

Nowadays I get much time to help my users and the perk of that I am writing this to all of the users who does not know how to add an extra field!

At first please install a child theme on your website because child theme is easier and safe to extend the functionality of WordPress.

 

This custom development has two parts. On the first part, I will show How to show the field on the registration form and then I will work to save those fields data in the user profile area. I have done a sample for you and you can use these codes on your website –

 

If you can check the code comment (/comment/) then you will see that on the first section I have added the filter and insert the registration field for the form. Also, It is showing correctly on the registration form.

screen-shot-2016-10-19-at-11-15-13-pm

Now, you have to save the field data on your user profile. To save the field I have used these filters- pre_user_first_name and pre_user_first_name. After updating those field, your user can easily insert his data on the form and admin/you will be able to see them in the user profile edit area.

screen-shot-2016-10-19-at-11-40-52-pm

 

This is how you can add some fields on the registration form without installing a plugin.

 

Thank you for reading till the end 🙂

 

2 thoughts on “How to add extra field on WordPress Registration form

  • This is a great post! However, I do not want to include the last name. I can hide the last name field via css, but how would you remove the Last Name error that happens since it is a required field?

  • @judy, you can remove the last name input box and then you can remove this filter add_filter(‘pre_user_last_name’, ‘user_last_name_wlx’);
    and the function “pre_user_last_name” 🙂

Leave a Reply

%d bloggers like this: