I had a situation where I wanted to be able to display a list of all the users on the website in my form using Fluent Forms.
We can achieve this easily using the fluentform/rendering_field_data_select
filter.
1. Create our form
First we need to configure our form, ready for our snippet. To do this we are going to add a dropdown field.
Next we need to open the advanced options
for the field and set our name attribute. This is a unique key we can target in the code.
2. Add the code
We are going to be using the hook fluentform/rendering_field_data_select.
You can read more about this hook here .
Defining some variables
Inside our hook, we’re going to define a couple of constants that we’ll use throughout the snippet.
$id
– this is your form ID that you want this to apply to$field_name
– this is the name attribute that we set our field we just created.