This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Show custom field "auteur" as author

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Show custom field "auteur" as author Reply To: Show custom field "auteur" as author

#29030
Ernest MarcinkoErnest Marcinko
Keymaster

Hi Tim,

Some filters have been changed in the most recent releases. Please try this code instead of the old one:

add_filter( 'asp_results', 'asp_author_from_cf', 10, 1);
function asp_author_from_cf($results) {
	foreach ( $results as $k => &$r ) {
		$authors = get_the_terms( $post_id, "auteur" );
		$author_names = array();
		if ( is_array($authors) ) {
			foreach ($authors as $a) {
			  $author_names[] = $a->name;
			}
			$r->author = implode(" | ", $author_names);
		} 
	}
	return $results; 
}

it should do the trick.