Documentation, Reference Materials and Tutorials for WPForms
Looking to collect more information from new users than just their name and email address? It’s easy when you set up custom user meta fields in WordPress, and create user registration forms with WPForms.
When you create a User Registration form using WPForms, you can add fields to your form to collect your custom user data. But in order to display the data in your user profiles, you’ll need to set up your custom user meta fields on your WordPress site first. In this guide, we’ll show you how to set up custom user meta fields in WordPress, and then collect that data with WPForms.
To access the User Registration addon, you’ll need to have the Pro license or above. If you don’t have access to the User Registration addon, you can learn how to upgrade your WPForms license.
What are Custom User Meta Fields?
Custom user meta fields are additional information you collect from your users during the registration process that WordPress doesn’t support on the user profile page natively.
For example, here are a few custom fields you can add to the user registration form on your site:
- Phone number
WPForms allows you to completely customize your user registration forms. Aside from text fields, you can add fields like dropdown menus, radio buttons, etc in your registration form.
But in order to see that data on your user profiles, you’ll need to set up those custom fields on your WordPress site, too; not just in WPForms. Otherwise, WordPress won’t be expecting that extra data and won’t know how to process and display it.
Let’s take a look at how to set up custom meta fields, so they can be seen in the user profiles.
Step 1: Install Advanced Custom Fields
The Advanced Custom Fields plugin helps you to handle the user meta fields in your registration form and display them in your users’ profiles. You can learn how to install a plugin if you’re not sure how to do it.
Step 2: Add New Custom Fields
To add custom fields in the newly installed plugin, go to Custom Fields » Add New.
You may add a title for your new field group. Let’s name it WPForms. Then, you’ll need to add a new field by clicking Add Field.
In this guide, we’ll add custom user meta fields for the user’s address, phone number, and gender.
For each custom field, you’ll be asked to specify a Field Label, Field Name and Field Type along with other optional fields.
- Field Label: It is the name appears on the profile page of your users.
- Field Name: This field is meta key in WPForms. This field will be created automatically once you specified Field Label. Though you can edit this field, always make sure to match it with the meta key field of WPForms. To make sure it matches, you may copy Field Name and insert in the meta key field of WPForms. We’ll show you how to do this in the next step.
- Field Type: You can select an appropriate field type for each field, like text, text area, number, password, etc.
You can now specify the required fields and leave the optional fields blank.
Below are a few recommendations for choosing the right field type in Advanced Custom Field.
- Address: Choose Text Area as the field type which is big enough to display the entire details at a glance in the user profile page.
- Phone Number: Choose Text as the field type. It is because phone numbers are stored in a string format that comes with special characters like brackets, which can’t be stored in the Number field type.
- Gender: If you’re using a dropdown menu in WPForms, choose Select or if you’re using a radio menu, choose Radio Button. Additionally, you’ll need to specify the choices in the Choices field. See the screenshot below.
After specifying the required fields for each WPForms field, scroll down your page and click Add Field until all the custom fields are added.
Then, click Publish. See the screenshot below.
Step 3: Create a User Registration Form
Now that your custom fields are set up, you can create a user registration form by navigating to WPForms » Add New. Then, select User Registration Form.
You can add new fields from the left panel and customize the order of fields using our drag and drop feature.
In this example, we’ll add the fields we created above: Address, Phone number and Gender.
Now you’ll need to match up your WPForms fields with your new custom user meta, so WordPress can understand what kind of data each field contains.
You can do that under Settings » User Registration. Then, scroll down the page until you find the Custom User Meta section.
Select only the custom fields you just created in the Advanced Custom Field. In this case, they are address, phone number and gender.
You can copy the field name from Advanced Custom Field panel and insert it into the meta key field. After adding each field, click the plus button to create a new field.
Once done, be sure to click Save.
Publish Your Form
To publish the form you just created, you can either create a new page or edit an existing page.
In the page editor, click the Add Form button just above the text editor. Now you’ll be asked to select a form. Select the form you just created and click the Add Form button.
Now, after users begin registering using your new form, you’ll be able to access their data by navigating to the user profile page.
To do that, first go to Profile » All Users. Then, select a user and click Edit. Finally, scroll down the page and look for the new fields under Account Management.
We hope this guide helped you to set up custom meta fields.
If you’d like visitors to be able to contribute content to your site without registering, you can also see our guide on how to install and use the Post Submissions addon.