How to add custom field in wordpress registration form and view it in user profile in the backend?
I’ve already google it but just find how to add it in user profile but not in registration process.
How to add custom field in wordpress registration form and view it in user profile in the backend?
I’ve already google it but just find how to add it in user profile but not in registration process.
Comments are closed.
I just went through this whole process myself. There isn’t a hook or anything to make this easy, so instead we have to “hack” it into place in order for it to work. It’s not pretty, but it gets the job done. I’ve been using it for months now with 3 custom fields and it’s been a big time saver to add my custom user info right from the beginning.
This will add the custom fields to the admin dashboard “
Add New User
” page. It shouldn’t be too hard to convert this into the public registration page if that’s what you’re trying to do.Add all of this code to your theme’s function.php.
Step 1: Add the fields to the Add User page:
Of course, rename every
custom_field_1
that you see to something that makes sense to you. Such aspets_name
or something.Step 2: Now that the field is displaying on the registration form, we need to save it to the database when we click Add New User:
Again, rename every
custom_field_1
to match what you did above.Now that it’s saved, this is how you can view it within Admin Dashboard > Users:
Again, match the
custom_field_1
to the name you’ve been using, andCustom Field 1
is the label you want to show on the manage user page.That should sum it up and get you started. Since it’s in the database now, you can do whatever you want with it – such as display it on the front page if the user is logged in.
If this answers your question, please click the checkmark to mark it completed.
If by “wordpress registration form” you mean the form at
wp-login.php?action=register
then there is a hook that can be used to add fields below the “email” line. For example…To save the data, hook into
user_register
as in this example from the Codex:There is very little detail to your question so it is hard to be more specfic.