1// We get a list taxonomies on the search box
2function get_tax_by_search($search_text){
3
4$args = array(
5 'taxonomy' => array( 'my_tax' ), // taxonomy name
6 'orderby' => 'id',
7 'order' => 'ASC',
8 'hide_empty' => true,
9 'fields' => 'all',
10 'name__like' => $search_text
11);
12
13$terms = get_terms( $args );
14
15 $count = count($terms);
16 if($count > 0){
17 echo "<ul>";
18 foreach ($terms as $term) {
19 echo "<li><a href='".get_term_link( $term )."'>".$term->name."</a></li>";
20
21 }
22 echo "</ul>";
23 }
24
25}
26
27// sample
28get_tax_by_search('Foo');