> For the complete documentation index, see [llms.txt](https://knowledgebase.ajaxsearchpro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.ajaxsearchpro.com/hooks/filters/index-table-related/asp_post_custom_field_before_tokenize.md).

# asp\_post\_custom\_field\_before\_tokenize

Gives access to each selected custom field related to post, before they are merged to tokenization

```
apply_filters('asp_post_custom_field_before_tokenize', $values, $post, $field);
```

### Parameters

* **$values** (array) - array of custom field values. Even if the field has a single value, it is converted to array.
* **$post** (WP\_Post) - post type object
* **$field** (string) - custom field name

{% hint style="danger" %}
The return value should always be an **array**
{% endhint %}

### Sample usage

```php
add_filter( 'asp_post_custom_field_before_tokenize', 'asp_change_cf_index', 10, 3 );
function asp_change_cf_index( $values, $post, $field ) {
    if ( $field == 'my_field_name' ) {
        return array('my custom value');    // Always as array!
    } else {
        return $values;
    }
}
```
