Skip to content

Instantly share code, notes, and snippets.

Created February 3, 2013 22:17
Show Gist options
  • Save anonymous/4703938 to your computer and use it in GitHub Desktop.
Save anonymous/4703938 to your computer and use it in GitHub Desktop.
Show tag cloud with tags from a specific user (add in functions.php).
add_filter('widget_tag_cloud_args','author_post_tag_cloud_tags');
function author_post_tag_cloud_tags($args) {
if (is_author()) {
global $post;
$wp_query = new WP_Query("showposts=-1&author=".$post->post_author);
$author_tag_ids = array();
while($wp_query->have_posts()) {
$wp_query->the_post();
$post_tag_ids = wp_get_post_tags( $post->ID, array( 'fields' => 'ids' ) );
$author_tag_ids = array_merge($author_tag_ids, $post_tag_ids);
}
wp_reset_postdata();
$args = array('include' => implode(',',$author_tag_ids));
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment