Skip to content

Instantly share code, notes, and snippets.

@mikedamage
Last active December 11, 2015 23:18
Show Gist options
  • Save mikedamage/4675463 to your computer and use it in GitHub Desktop.
Save mikedamage/4675463 to your computer and use it in GitHub Desktop.
<?php
function get_author_tags($id) {
$user_tags = array();
$query = new WP_Query(array(
'posts_per_page' => -1,
'author' => $id,
));
while ($query->have_posts()) {
$query->the_post();
$tags = (array)get_the_tags();
foreach ($tags as $key => $val) {
if ($val->term_id > 0) {
if (!array_key_exists($val->term_id, $user_tags)) {
$user_tags[$val->term_id] = $val;
}
}
}
}
return $user_tags;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment