Get a List of an Author’s Tags in WordPress

January 30, 2013

One of the things we wanted to add to our updated site was an author info box at the bottom of each post. We thought it would be cool to have a list of the tags under which each author has published beneath their bio, but WordPress doesn’t have a built-in function to accomplish that. Luckily, it was pretty simple to roll our own.

First, we used WP_Query to get a list of all posts by a specific author. Next, we iterated through each post and grabbed its tags, populating an associative array with unique tag names. Here’s the basic function, with some extraneous stuff like caching removed to make it more universal:

Using the function is pretty simple. Just grab the tag array and loop through it:

This function could become pretty expensive on a site with lots of posts, so it’s a good idea to add caching to the mix. Here at FRC we use some custom Memcached functions in our functions.php file, but there are plenty of ways to skin that particular cat. I’ll cover them in a later post.

Mike is the Senior Web Developer (AKA Code Ninja) at Fifth Room Creative. He's been known to blog about web development related topics as well as general nerdery things here on the Fifth Room blog. You can follow him on twitter at if you like what he has to say.

My Topics: CSS3, JavaScript, jQuery, Web Development, RWD, Development, PHP, Pods, WordPress, Linux, Vagrant, Geek