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
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
That’s it, you now have multiple post types included in your WordPress author archives!
About the Author
Kevin Leary is a freelance developer in Boston, MA with a strong portfolio of work, and over 13 years of experience as a programming consultant and digital strategy provider. Interested in working together? Hire me for your next project.