I get terms from all my posts with get_terms,

$tags = get_terms( 'mytags', '&number=5&orderby=date&order=desc&hide_empty=1' );
foreach ( $tags as $tag ) {
    echo '<a href="'.get_bloginfo('url').'/tags/'.$tag->slug.'">'.$tag->name.'</a>';

Is it possible to get_terms included to the posts made by author? I try to add a list with all the terms (tags) in author.php template,

thanks a lot!

  • Terms aren't specific to author, they're specific to post types or posts, please clarify your question. – t31os Dec 10 '11 at 18:38

Not directly, because terms are assigned to posts, not authors.

You will need to query all posts, get their terms and authors, and then filter out terms which came with posts that have other authors than get_query_var('author').

Note that depending on the number of posts your site has, this kind of query could be very expensive. A better way would be to either record term IDs inside an user meta key during save_post (still kind of slow), or create your own table with the data you need (fast).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.