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.
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.
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.
Next, go to the Advanced Options section where you’ll see the Dynamic Choices dropdown, 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.
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 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.
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.