Do you want to dynamically populate fields with your site content? Dynamic field options will automatically pull all post titles, categories, or similar details from your site, saving you the time and effort of creating and updating these options.
This tutorial will show you how to create dynamic field choices in WPForms.
Adding a Dropdown, Multiple Choice, or Checkboxes Field
To begin, you’ll need to edit an existing form, or create a new form. For this example, we’ll use the Request A Quote form template.
To create a dynamic field you’ll need to add any of the following field types: Dropdown, Multiple Choice, or Checkboxes. In our example we’ll add the Dropdown field to our form.
To configure the settings for the Dropdown field, click on it to open up the Field Options panel.
Then, we’ll begin by changing the Label to Products.
Setting Dynamic Field Choices
Next, go to the Advanced tab. Here you’ll see the Dynamic Choices dropdown, where you’ll have two choices:
- Post Type: The different content types on your WordPress site, such as Posts and Pages.
- Taxonomy: The groups or labels used in classifying posts and custom post types, such as Categories and Tags.
In our example, we’ll select the Post Type option.
When the Post Type option is selected, you’ll see the Dynamic Post Type Source dropdown field, which will include all the post types available on your site. In our example, we’ll select Products.
Note: In this example, we’re using a custom post type. For more details, be sure to check out WPBeginner’s tutorial on creating custom post types.
Now, when a user views the form, the titles of all published Products posts will be listed as options in this Dropdown field.
That’s it! You can now create a form with dynamic fields auto-populated with the titles of existing posts, pages, or taxonomies within your website.
Next, do you want to manage submitted form entries? Then be sure to check out our detailed guide on form entries.