Forums Forums Search & Filter Pro ACF-taxonomy field showing term ids not term names

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #161657

    I use an ACF – taxonomy field in a filter. Previously it showed the term names in the drop down, but now I get a list of term ids.

    Trevor
    #161662
    This reply has been marked as private.
    Anonymous
    #161666

    I solved the problem using the ‘sf_input_object_pre’ filter:

    add_filter('sf_input_object_pre', 'pas_filterlabels_aan', 10, 2);
    	function pas_filterlabels_aan($input_object, $sfid) {
    
    		if($input_object['name'] == '_sfm_vakdomein') {
    			foreach($input_object['options'] as $option) {
    				$term_id = $option->value;
    				if ($option->value) {
    					$term = get_term_by('id', $term_id, 'cursussoort');
    					$term_label = $term->name;
    					$option->label = $term_label.' ('.$option->count.')';
    				}
    
    			}
    			
    		}
    	
    	return $input_object;	
    	}

    Replace ‘_sfm_vakdomein’ by your input object name (is shown in the query string) and ‘cursussoort’ by your taxonomy slug.

    Trevor
    #161671
    This reply has been marked as private.
    Anonymous
    #161744

    The devopment version seems to behave as expected.

    Thank you

    Trevor
    #161746
    This reply has been marked as private.
Viewing 6 posts - 1 through 6 (of 6 total)