Displaying Custom Post Types in a Custom Taxonomy Archive

The project I was working on today required a custom post type that included a custom taxonomy. Setting this up on the back end was simple. However, when I went to the front end, all the posts in the custom post type were missing from the custom taxonomy archive. Since it took me way too long to figure out the source of this issue, I’m going to document it here.

It all comes down to this poorly named setting:


When registering a post type, this setting determines whether or not your custom post type will show up in your site’s search results. However, it also has the unexpected side effect of determining whether or not your custom post type will show up on taxonomy archive pages. If you want to include your custom post type in custom taxonomy archives, exclude_from_search must be set to false:

'exclude_from_search' => false,

Note: If the “public” setting is set to “true” then the “exclude_from_search” setting can simply be removed.

Special thanks to Pieter Goosen for mentioning this issue in this Stack Exchange thread.

This issue is also mentioned in the “exclude_from_search” section of the old WordPress Codex page for registering custom post types.

Posted in

2 thoughts on “Displaying Custom Post Types in a Custom Taxonomy Archive”

  1. Definitely something that needs documented more. I happened to stumble upon that same StackOverflow post earlier today when helping someone out with the same issue, while they were using our Custom Post Type UI plugin.

    I\’m now planning to document the side effect in some way within CPTUI\’s help text and/or FAQs section. Possibly also with my own blog post from my personal web development site.

    Keep up the good work with documenting your own gotchas with WordPress, Post Types, and Taxonomies.

    1. Thanks Michael!

      It’s such a strange issue. If you write up a post with more info than I have here, let me know so I can link to it as well.

Leave a Comment

Your email address will not be published. Required fields are marked *