Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
    
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
    
thanks @t31os, i edit the question. –  Philip Dec 10 '11 at 20:46

1 Answer 1

up vote 3 down vote accepted

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).

share|improve this answer
    
thanks a lot @One Trick Pony! –  Philip Dec 10 '11 at 20:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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