0
votes

I have a custom post type called reviews. I have added a category taxonomy and had added my custom post types under the new category taxonomy. When I click on that category it doesn't show any of my custom posts. It will only show regular posts.

Any suggestions on how I can fix that?

1

1 Answers

0
votes

use the below function and put this on your themes functions.php

function add_reviews_post_type( $query ) {
  if( (is_category() || is_tag()) && $query->is_archive() && empty( $query->query_vars['suppress_filters'] ) ) {
    $query->set( 'post_type', array(
     'post', 'reviews'
        ));
    }
    return $query;
}
add_filter( 'pre_get_posts', 'add_reviews_post_type' );