This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: How to Max Length CustomField result to 100

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to Max Length CustomField result to 100 Reply To: How to Max Length CustomField result to 100

#30444
Ernest MarcinkoErnest Marcinko
Keymaster

Actually, I think so, maybe this variation:

add_filter('asp_cpt_advanced_field_value', 'change_asp_cpt_advanced_field_value', 10, 2);
function change_asp_cpt_advanced_field_value($value, $field_name) {
        // Each line 'field_name' => length
        $fields_length = array(
		'custom_field_2' => 100,
		'custom_field_3' => 200
	);
	
	if ( isset($fields_length[$field_name]) ) {
		return wd_substr_at_word($value, $fields_length[$field_name]);
	} else {
		return $value;
	}
}