Support

Account

Home Forums General Issues How to use the taxonomy/result filter? Reply To: How to use the taxonomy/result filter?

  • For what it’s worth I found a workaround for anybody needing similar functionality. What I did was use the update_value filter to create custom meta data based on taxonomy term names. Here is a snippet of the code:

    
    function custom_acf_values(  $value, $post_id, $field ) {
    
    	// Set authors
    	if( $field['name'] == 'authors' && $value != '' ) :
    
    		$names = '';
    		$authors = $value;
    	    
    	  if( $authors ) :
    
    		  foreach( $authors as $author ) {
    
    		  	$sep = '; ';
    		  	if( $author == end( $value ) ) {
    		  		$sep = '';
    		  	}
    
    		  	$author = get_term( $author, 'authors' );
    		  	$name = $author->name . $sep;
    
    		  	$names .= $name;
    	  	}
    	  endif;
    	  update_post_meta( $post_id, 'poster-authors', $names );
    
    	endif;
    }
    add_filter('acf/update_value', 'custom_acf_values', 10, 3);
    

    However, I am still interested in learning more about the filter I mentioned in OP.