Multiple post types in archives (filter?)

Try this:

function sw_custom_post_type_includes($query) {
        $post_types = array('post','custom1','custom2','custom3');
        if ( ! is_archive() && ! in_array( get_post_type(), $post_types ) )
                return $query;

        $query->set( 'post_type', $post_types );

        return $query;
}
add_filter('pre_get_posts', 'sw_custom_post_type_includes');

Leave a Comment