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
December 1, 2020 at 9:51 am
#30436
Keymaster
Actually, I may have found a much better solution. Instead of the previous code, you can use the one below. With that, you can use the advanced description field as before, it will automatically change the maximum length of all field values to 100:
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) {
$length = 100;
return wd_substr_at_word($value, $length);
}