A filter used to populate the Dynamic Choices for post types and taxonomies.


(array) (Required) Arguments from the post submission such as Category ID, Tag ID, Author ID etc.
(array) Sanitized entry field values/properties.
(int) Form ID.



More Information

The wpforms_dynamic_choice_post_type_args filter provides a list of supported arguments from the post such as Cateogry. Similarly, you can also use the wpforms_dynamic_choice_taxonomy_args to pull arguments from the taxonomy of Tags.

In this example shown below, the function will process on form ID 789 for field ID 10 and only include posts from the category 11.


 * Limit posts or pages displayed by category.
 * @link
 * @param array $args       Arguments from post submission.     
 * @param array $field      Sanitized field data. 
 * @param int   $form_id    Form ID
 * @return $args
function wpf_dev_dynamic_choices_categories( $args, $field, $form_id ) {
	 if ( $form_data[ 'id' ] == 789 && $field['id'] == 10 ) {
	 $args['category'] = '11';

     return $args;

add_filter( 'wpforms_dynamic_choice_post_type_args', 'wpf_dev_dynamic_choices_categories', 10, 3 );

Snippet Reference: How to Exclude Posts, Pages or Categories From Dynamic Choices