I'm using get_tags
(outside the loop) with the argument name__like
to return tags containing one, two or three exact and specific words.
I already tried (not working):
$args = get_tags( 'orderby' => 'name','order' => 'ASC', array('name__like' => 'group', 'name__like' => 'worker', 'name__like' => 'student' ) );
and I also tried to use get_terms
(not working):
$args = get_terms( 'post_tag', array('name__like' => 'group', 'name__like' => 'worker', 'name__like' => 'student') );
It only seems to work when I try to get tags containing only one word, like this:
$args = array('orderby' => 'name','order' => 'ASC','name__like' => 'worker',);
I'm finding a bit lost... Is not possible to use an array here?
This is the rest of my code, so far:
$tags = get_tags($args );
if ( !empty( $tags ) && !is_wp_error( $tags ) ): ?>
<?php foreach ( $tags as $tag ): ?>
<?php echo '<a href="'.get_tag_link($tag->term_id).'" title="'.$tag->name.'" rel="tag">'.$tag->name.'</a>';?>
<?php endforeach; ?>
<?php endif; ?>
get_terms
/get_tags
is no use for this and you'd have to write a custom querygroup worker student
, but notworker student
? Or tags likebig worker
but notsmall person
?