asp_pre_get_front_filters

Runs before the array of frontend filter objects are returned to the output handler.

For more usage examples, please check the Frontend Filters API section.

apply_filters('asp_pre_get_front_filters', $filters, $type);

Parameters

  • $filters (aspFilter[]) - Array of filters

  • $type - Filter type

Usage

add_filter('asp_pre_get_front_filters', 'asp_change_a_filter', 10, 2);
function asp_change_a_filter($filters, $type) {
  if ($type == 'custom_field') {
    foreach ($filters as $k => &$filter) {
		if ($filter->data['field'] == 'field_name') {
			$filter->attr('Old Label', 'label', 'New Label');
			break;
		}
    }
  }
  
  return $filters;
}

Last updated