WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have posts and I have recipes. Recipes is a custom post type. Recipes make use of the category taxonomy and a newly added recipe has been categorized under beer. When I browse the listing page for the category beer I see all my previous posts categorized under beer while the new recipe does not appear.

How do I link custom post types through their taxonomies? Or, how can I show all post types under a single category?

share|improve this question
up vote 2 down vote accepted

You can use pre_get_posts hook to add your custom post type to the query

function include_recipes( $query ) {
    if ( $query->is_category ) {
        $query->set( 'post_type', array('post','recipes') );
    return $query;
add_filter( 'pre_get_posts', 'include_recipes' );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.