---
title: fluentform/rendering_field_data_select
description: "## Description To populate the dropdown filter with your own custom values use this filter. For example post types, user name. ```php $data = apply_filters('fluentform/rendering_field_data_select', $data, $form); ``` ## Usage The following code will add two new options to your…"
url: "https://fluentforms.com/docs/fluenform_rendering_field_data_select/"
updated: "2023-11-28"
category: Filter Hooks
---

# fluentform/rendering_field_data_select

## Description

To populate the dropdown filter with your own custom values use this filter. For example post types, user name.

```php
$data = apply_filters('fluentform/rendering_field_data_select', $data, $form);
```

## Usage

The following code will add two new options to your dropdown field. Here we have used the dropdown input name attribute as 'dynamic_dropdown', make sure it matches your attribute name. This snippet will run for the form id with 91.

For example, we have passed an array of two values, here you can pass your own data, you can use [WP_Query](https://developer.wordpress.org/reference/classes/wp_query/) or another way to fetch your data but it needs to match the data format as shown in the example.

```php
add_filter('fluentform/rendering_field_data_select', function ($data, $form) {

    if ($form->id != 91) {
        return $data;
    }

    // check if the name attriibute is 'dynamic_dropdown'
    if (FluentFormFrameworkHelpersArrayHelper::get($data, 'attributes.name') != 'dynamic_dropdown') {
        return $data;
    }

    // We are merging with existing options here
    $data['settings']['advanced_options'] = array_merge($data['settings']['advanced_options'], [
        [
            "label"      => "Dynamic Option 1",
            "value"      => "Dynamic Option 1",
            "calc_value" => ""
        ],
        [
            "label"      => "Dynamic Option 2",
            "value"      => "Dynamic Option 2",
            "calc_value" => ""
        ]
    ]);
    return $data;
}, 10, 2);
```

If you use this you will also need the following code, which bypass the select backend validation for inserting datas that are not present in fluent form database.

```
add_filter('fluentform/validate_input_item_select',function ($error,$field){
    return [];
},10,2);
```

## Parameters

- **$data** Array ( input field settings & attributes)
- **[$form](https://fluentforms.com/docs/form-object/)** Object

## Placement

This code should be placed in the [functions.php](http://codex.wordpress.org/Theme_Development#Functions_File) file of your active theme or you can use a PHP code snippet plugin.

## Source Code

This filter is located at fluentform/app/Services/FormBuilder/Components/Select.php
