function namespace_add_custom_types( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array(
'post', 'post_type1', 'post_type2'
));
return $query;
}
}
add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
it worked realy good.
Related Posts:
- How can I get archives for specific category without category_base in the url?
- Modify text after post count
- Get archives as array
- Get posts from a top category and group by child categories
- Parent and child relation code and display only first child list
- Trying to hide subcategories which have categories without posts
- Exclude a specific category link from archive / front page
- Filter the post listing for a particular category from archive month list
- WP Archive & Category Pages not filtering
- How to get category and archive title?
- How do I remove unwanted pages like archive, search, etc.?
- get_categories for custom post type with a specific custom taxonomy attached
- How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling
- Displaying category archive of custom post types
- What’s the URL for a category archive?
- How can I get posts in a subcategory to display on it’s parent categories archive page?
- What is archive.php used for?
- Sort posts by tags in category pages
- How do I visit archive-post.php?
- How do I make wp_get_archives show me months where only pages were created?
- Sort custom-posts in archive.php via meta-key?
- Create a month by month archive of pages (not posts)
- Root level category, tag, author and archive pages to work
- display archive as collapsing links
- Are Custom Taxonomy Templates Possible?
- Customize first page of category
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- Display only posts from referred category on date archive page
- Using widget logic I want to show only a widget on the archive page if there are no posts
- front end publishing not working on front-end page
- How to show static placeholder when less post elements in archive page?
- Creating archive pages for children categories
- Show only post titles in archives?
- WordPress categories being called “archives” in google links. How to remove?
- How to hide a post from archives
- conditional for sub category on archive page
- weekly archive for custom category
- List of the years with posts presented
- Does only custom post type have post type archive pages?
- How to remove category titles?
- Custom archives function
- Page is displaying blog archives
- terms_description and admin problem
- How can I define a custom archive for childs of a specific category?
- add_rewrite_endpoint returns 404 on archives
- Multiple category archive page
- Filtering out child category posts from parent category archive not working
- Author archive doesn’t work [closed]
- How to conditionally check for author archive when is_author() fails to work because the author has no posts
- Is there a better way to do headings for (all) archives?
- Date Archive pages 404 error
- Customize category page for different custom taxonomies
- Archieve.php not loading for custom post type
- remove 2014 from wp_get_archives
- How can I make a page for post formats (specifically quotes) in wordpress 3.5
- How to Remove a Title from All Category and Tags Page?
- Do not show sub categories in the loop on archive-product.php
- why get_the_post_thumbnail( the_ID()) echos extra post id
- singular posts using archive styling
- display category list year wise in wordpress
- Is there a way to multiply archive loop results sequentially?
- pre_get_posts conflict with archive posts
- WordPress monthly archive category specific
- Custom loop in addition to default on archive page
- Show Daily Archives after specific dates
- Show Secondary Sidebar on Category pages (archive)
- Remove posts from two categories in Archive Page
- Advanced archive url structure (category, tag and date)
- Difference between $numpages & $max_page on archive pages
- Custom post archive page not opening 404 page
- How to overwrite the category template in a plugin
- How to disable date archives?
- List of post categories only associated to another custom taxonomy
- Archive page no content to display
- Simplest way to archive a WordPress (and take down)?
- Posts are not displaying on their category and tag page
- How to Completely Remove Archive Title a.k.a the_archive_title?
- Display all posts from specific category
- Meta Box: display single image on an archive-template
- Make category archives page in menu non-clickable
- Adding Custom Post Types to category/tag/author archives breaks header content
- Get posts from category from custom query
- Custom Category Archive Pages
- How to get get_categories()’s ‘hide_empty’ argument to work with global year var in the archive template?
- Show full category tree for a year with all post titles?
- How can I generate a list of post-type specific categories?
- How to toggle custom WP archive list
- Create monthly archive for parent category
- Display future posts in archive
- How to count the number of monthly archive?
- Conditional statements based on custom meta value in category archives
- How to organise post by category and date
- Archive by Year
- Create archives by author role
- Stop header code from showing in category page?
- A problem with date archives
- Show all posts in category
- Show monthly or daily archives
- Main loop querying current template’s info only in custom category archive pages, not my posts
- WordPress 3.6 – archive.php doesn’t get triggered [closed]