Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

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

Viewing 6 posts - 1 through 6 (of 6 total)
  • Rob Ruifrok
    #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 Moderator
    #161662
    This reply has been marked as private.
    Rob Ruifrok
    #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 Moderator
    #161671
    This reply has been marked as private.
    Rob Ruifrok
    #161744

    The devopment version seems to behave as expected.

    Thank you

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

The topic ‘ACF-taxonomy field showing term ids not term names’ is closed to new replies.