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');
Related Posts:
- Filter for “get_post_type_archive_link()”
- Filtering WP_Query
- How do I add custom HTML to the content of an archive page’s posts?
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- Is possible register two archive pages for single custom post type?
- single-{$post_type}-{slug}.php for custom post types
- Row actions for custom post types?
- remove custom post type permalink
- Custom Post Type Archives by Year & Month?
- Saving Taxonomy Terms
- Get custom post type slug for an archive page
- Filter by custom field in custom post type on admin page
- How can I remove the “Add New” button in my custom post type?
- Media library – Limit images to custom post type
- Custom post type pagination 404 fix?
- Sort search results by post type
- Adding content to archive and taxonomy pages on custom post types?
- Filtering a custom post type by custom taxonomy in archive template
- Permalink Structure for Multiple Post Type Archives by Taxonomy
- get term archive url / link
- How to get the custom post type from an archive page?
- How to remove “Archive:” label from archive title
- How to order posts of a custom post type by date DESC in dashboard Admin?
- Why are posts from custom post type not displayed in “category” archive?
- How to remove Filters from post admin page?
- Custom Post Type Archives by Date and Taxonomy
- Displaying category archive of custom post types
- Custom sortable columns ordered by meta-value?
- Custom post types – Use post_id in permalink structure when using has_archive => true
- How to change “Draft” string for status of custom post type to “Unavailable”?
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- Adding a drag and drop re-ordering from a custom post type default list [closed]
- How can I filter posts by post_parent in the admin?
- $query->set in pre_get_posts is unintentionally affecting the backend
- Pagination throws 404 error on custom taxonomy archive pages
- How do I filter the excerpt metabox description in admin?
- How do I Filter Custom Post Type by Custom Taxonomy in the newest WordPress RESTful API?
- Setting up custom post type archives in WP3.1? Any luck?
- Proper way of making custom post type landing page or archive page
- How do I display two separate taxonomy archives for two post types that share a single taxonomy?
- Custom Post Type Archives by Date with Custom Permalink
- How to correctly get post type in a the_title filter
- How to add meta box to backend menu page
- How to add a CSS class to every image in a Custom Post Type
- Custom Post Type Archive Page: Set Posts Per Page, Paginate
- Best way to filter featured image text for a custom post type?
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- Change title in head on Archive page
- Display Editable Text Above CPT Archive Listings
- Custom Post Type Archives with 0 Posts Redirects as 404
- How to show more posts on an archive page?
- Archive page with multiple taxonomies rewrite
- Multiple Paginations on one Page
- Create permalink structure for one taxonomy archive per custom post type
- Archive page…limiting posts per page
- WP 3.1 – archive pages for custom content types possible now without a plugin?
- Page is defaulting to archive page and not designated template
- Filter by custom Field for Custom post type Admin Listing
- Most efficient way to search for values from CPT in Post content
- WP Admin default view mode for Custom Post Type
- Date archives for custom post type
- Custom Post Type Archive URL takes over page URL
- Custom comment status possible?
- post_type_link filter causes 404 on the CPT page it’s used on
- Remove wpautop from all posts/pages except my custom post type
- Better to use a post type archive, page template, or shortcode for generating a highly configurable CPT archive?
- Remove date and category filters when editing custom post types
- Display all custom post types in archives.php
- Taxonomy terms with edit/filter link in wp-admin, in the list of custom posts
- Make the ‘all’ filter default instead of ‘mine’ in a custom post type
- How to Add Pages Under Custom Post Type URL Structure?
- Custom Post Type Archives by Date (stored as meta value) WP3.1
- WordPress custom post type category pagination 404 Error
- Exclude custom function content from certain pages
- Title_save_pre – Simple problem that u know for sure
- Filter get_categories() for taxonomy term in WordPress
- Custom Permalinks for Custom post Type Archives?
- Debug output during filter execution doesn’t work
- is_singular won’t call my functions?
- Show Custom Post Type by Author
- Custom post type archive with pagination?
- Custom post type tag archives don’t work for basic loop?
- Ajax filter with custom taxonomies
- Filter posts with ajax form and checkboxes
- Removing CPT slug from URL results in 404 error for archive page
- Pages, Custom Posts & Custom Taxonomy defining slug structure
- Image size filtering in Media uploader according to custom post type
- How to show a tag archive of one post type only
- How to remove CPT comment feed from head?
- How to let custom post type posts show in standard post archive (like in homepage)?
- Regex problem in an add_rewrite_rule
- paginate function in archive for custom-post-type
- Custom taxonomy archive page not working
- Include Custom Posts Type in Year/Month/Date Archive
- Change plugin’s has_archive = true to false?
- Unable to filter on field on edit.php page
- where can I see my custom post type archive template?
- wrong template for page of archive
- wp_query and comment_parent – select only posts with top level comments
- Highlight nav menu terms