Home › Forums › General Issues › How to auto-populate WPForms 'Dynamic Post Type Source' dropdown with a list of › Reply To: How to auto-populate WPForms 'Dynamic Post Type Source' dropdown with a list of
It has been a very long time since I’ve done this and a better source of information would be to contact support over at WPForms, they are generally very helpful.
But, I did once upon a time create do dynamic generation of field choices for a WPForms field. It involved using this hook
$filtered_field = apply_filters( "wpforms_{$field['type']}_field_display", $field, $attributes, $form_data );
You can supply a filter for each field type. Here is a list of all the filters available for WPForms.
I can tell you that you need to check the form ID $form_data['id']
and the field ID $field['id']
to make sure that you are altering the correct field.
Just like acf there is $field['choices']
and each choice is an array
array(
'label' => 'XXXXX',
'value' => 'YYYYY'
)
and that there may be other indexes depending on the field type.
That is a about the extent of what I can offer.
I did use a lot of this when I was building the filter and just like ACF it gave me information about the field I was working on at the time.
echo '<pre>'; print_r($field); echo '</pre>';
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.