Skip to content

Instantly share code, notes, and snippets.

@dededey
Created September 29, 2015 08:57
Show Gist options
  • Save dededey/9636c84f7e6a5cc60cb0 to your computer and use it in GitHub Desktop.
Save dededey/9636c84f7e6a5cc60cb0 to your computer and use it in GitHub Desktop.
function add_custom_types_to_tax( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
// Get all your post types
$post_types = get_post_types();
// $post_types = array( 'post', 'your_custom_type' );
$query->set( 'post_type', $post_types );
return $query;
}
}
add_filter( 'pre_get_posts', 'add_custom_types_to_tax' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment