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

The return value should always be an array

Sample usage

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;
}
}