How to Set Dynamic Field Default Values in WPForms

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. In this tutorial, we’ll show you how to create dynamic field choices.

Setting Dynamic Field Choices

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.

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 into our form.

Dropdown field

To configure the settings for the dropdown field, click on it to open up the Field Options panel. We’ll begin by changing the Label to Products.

Field label

Next, go to the Advanced Options section where you’ll see the Dynamic Choicesdropdown, where you’ll have two choices:

  • Post Type: refers to different content types on your WordPress site, such as Posts and Pages.
  • Taxonomy: refers to 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.

Dynamic Choices in Advanced options

When the Post Type option is selected, you’ll see the Dynamic Post Type Sourcedropdown 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 on how to add and use a custom post type on your WordPress site, check out WPBeginner’s tutorial on how to create a custom post type.

Dynamic post type source

When a user views the form, the titles of all published Products posts will be listed as options in this dropdown field.

Dropdown field front end

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.

Related Articles