Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Problem with searching in custom post › Reply To: Problem with searching in custom post
July 29, 2015 at 10:05 am
#5428
Hi!
Well, I think the upper mentioned code won’t work, because the ‘auteur’ is not a meta field, but a taxonomy term.
Try something like:
<?php
// This is the taxonomy
$taxonomy = 'auteur';
// We only want to do this on posts/pages/custom post types
if ($r->content_type == 'pagepost') {
$terms = get_the_terms( $r->id, $taxonomy );
if (is_array($terms) && count($terms) > 0)
echo "<div class='author'>" . $terms[0] . "</div>";
}
?>
Best,Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
![](https://wp-dreams.com/assets/envato/comment-button-knowledgebase.png)
![](https://wp-dreams.com/assets/envato/comment-button-support.png)
![](https://wp-dreams.com/assets/envato/comment-button-facebook.png)
![](https://wp-dreams.com/assets/envato/comment-button-twitter.png)