apply_filters( 'ep_facet_meta_value_max_strlen', $length, $meta_key ) → {int}
Max length of each value in the facet.
To set it to only display 3 characters of each value when the meta_key is my_key
:
add_filter(
'ep_facet_meta_value_max_strlen',
function( $length, $meta_key ) {
if ( 'my_key' !== $meta_key ) {
return $length;
}
return 3;
},
10,
3
);
Please note that this value is cached. After adding that code to your codebase you will need to clear WordPress's cache or save a post.
Parameters:
Name | Type | Description |
---|---|---|
$length |
int | Length of each value. Defaults to 100. |
$meta_key |
string | Key of the field. |
- Since:
- 4.3.0
- Source:
Returns:
New length.
- Type
- int