, LLC.

Adding Custom Post Types to Author Archives in  WordPress

All code samples have been moved to a GitHub Gist.

WordPress automatically generates archives for each blog author, listing all posts created by that author. But what happens when you have a system with custom post types that you want to attribute to appear on an author archive?

This requires a small bit of programming, but luckily it’s very easy to do using the following post_types_author_archives() function.

Drop this function into your theme’s functions.php file, or your plugin source code, and edit the post types you wish to include into the author archives on Line 8 using the array passed an argument to $query->set.

That’s it, you now have multiple post types included in your WordPress author archives!

Meet the Author

Kevin Leary, WordPress Consultant

I'm a freelance web developer and WordPress consultant in Boston, MA with 16 years of experience building websites and applications. View a portfolio of my work or request an estimate for your next project.