Back to Top

How to Add Additional Profile Fields in WordPress

How to add custom fields to Registration & profile in WordPress

Sometimes you want to add extra fields into the default registration provided by WordPress.As we know, By default WordPress provide registration with some two-three fixed fields and for some reason we need to add some new fields into registration so, Today I am going to explain to you how you can add extra fields into registration and profile page in WordPress.

For adding extra fields, we need to create hook using an add_action function and you just need to place code into function.php file of theme and drag below PHP code.

Below action register_extra_fields is used to add an extra field into the layout of registration.

Here, I have just used the title, first name and last name as extra fields.

NOTE: Above code will be added after the existing fields in registration form but if you want to move it to top, you can change position of below code into wp-login.php file.

Next, we need to call action for checking errors and required fields which are like below

Now,Let’s go ahead and create an action to add extra fields information into database.WordPress provides easiest way to add additional user information through the add_user_meta(), delete_user_meta(), get_user_meta(), update_user_meta() functions.This functions does not update the wp_users table, but update the wp_usermeta table. This is by default database layout provided by wordpress which allows one specific table to hold all additional user information.

That’s it we are done with adding extra fields on the registration form / registration page. Now let’s move to profile page.

First of all, we need to add action for displaying fields into profile page and then for updating information into database

Now, same like registration let’s update profile information into database using below action hooks:

That’s all you are done with adding custom fields into registration and profile in WordPress

Thanks for reading and feel free to share your thoughts! Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Comments (8)

  1. Thanks for sharing your thoughts on Profile.
    Regards

  2. Thanks alot for this script.!

  3. Yes , now finally i got a full tutorial on this , thanks !

  4. Great information with many thanks. I have been searching for this all along and it was all here! Now I shall comfortably customize my word-press website with the fields of my choice.

    Is it possible to add anew menu for new users? I need a menu that is not visible to users that are not logged in

    1. Yeah you can create menu for logged in users only.

  5. HI Bhumi,

    I am new to wordpress and was looking for adding fields to Registration page and like your simple approach.
    When i copy paste your code in the theme Function.php file and after that i cannot load the wordpress dashboard or site.
    Do you think something is missing in the above code or i am putting it at wrong place.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

JQuery Animation effects

Posted on 12 years ago

Bhumi