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
- Sort results by name & asc order on Archive.php
- Default archive URL wordpress
- Increase number of posts in archive page
- How to get category and archive title?
- Get rid of WordPress category, tag and author archives?
- How To Create A Paginated List Of All Categories On My Site?
- How do I remove unwanted pages like archive, search, etc.?
- Filtering a custom post type by custom taxonomy in archive template
- Category archive by year with permalink support /category/YYYY
- get_categories for custom post type with a specific custom taxonomy attached
- Why are posts from custom post type not displayed in “category” archive?
- How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling
- How can I lock down an old wordpress install I don’t intend to update?
- Displaying category archive of custom post types
- 404 Error On Category and Tags Pages
- Force WordPress to Show Pages Instead of Category
- How do I place content on archive pages but not on main page?
- Decreasing the Memory Consumption of a WordPress Site?
- What’s the URL for a category archive?
- WordPress Posts By Date/Day?
- How can I get posts in a subcategory to display on it’s parent categories archive page?
- How can I get the Month Name from Archive?
- Preventing 404 error on empty date archive
- is_archive() returns false on the archives page
- What is archive.php used for?
- Archive by Year
- Sort posts by tags in category pages
- How to get the category of the post and link it to the archive (of the category)
- Archive widget – limit number of months to 12
- How do I visit archive-post.php?
- How to hide a specific category posts in my monthly archive?
- Optimal way to redirect home page to category archive?
- How do I make wp_get_archives show me months where only pages were created?
- Display posts links from a category group by year
- Display list of Sub-Categories and the posts they contain, within one main Category
- Sort custom-posts in archive.php via meta-key?
- Including post_type = ‘wiki’ in author archives
- Sort category page with custom field
- Archive listing of posts by publish year (multiple years)
- How to create tabled index of posts in a certain category
- Output yearly archive within a page
- Regex problem in an add_rewrite_rule
- How would you create a “weekly” archive?
- Sticky Posts Not Sticking to Top of Category Archive
- Display most recent post in category instead of archive?
- Create a month by month archive of pages (not posts)
- Root level category, tag, author and archive pages to work
- How to show specific year archive into dropdown list
- Single.php Active Category Class
- Archive filtering posts by year and month
- How to get the date dynamically from archive.php to date.php?
- How to make a custom Archive Page
- Making next_posts_link(); return posts by month
- Category Specific Archive
- How to have Multiple Archives Widgets, one archive widget per category (in a different page)?
- Count posts for each year
- How can I change the way dates shown in the archive widget?
- display archive as collapsing links
- how do I get the date in a date archive page
- How can I get the ID for an archive page? [closed]
- Are Custom Taxonomy Templates Possible?
- “Sticky” posts for each category (archive.php)
- get_post_type_archive_link(‘post’) returns current category archive
- if in_category on archive.php
- I want exclude the particular category in sidebar
- Archive in sidebar with dropdown list of Year – Month – Day
- Arrange and separate posts
- How can I organize/create an archive listing by Year and month
- Change behavior depending on content length
- get_categories for custom post type and filter by custom taxonomy (brand) and list child categories of a defined category
- Customize first page of category
- How to filter archives both by category and tag?
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- How to edit archive page’s content inside wordpress dashboard?
- Display only posts from referred category on date archive page
- Cache previous versions of website?
- Using widget logic I want to show only a widget on the archive page if there are no posts
- Archive pages for posts based on their taxonomy?
- What type of page should i use? static page or category page? and what’s the difference? [closed]
- front end publishing not working on front-end page
- Category page only displaying the posts from a custom type
- How to show static placeholder when less post elements in archive page?
- Creating archive pages for children categories
- custom taxonomy archive by year
- Display “add to cart” button on every listing in product category page?
- condition for only if is archive for default post type
- Show only post titles in archives?
- Remove author archive
- Preview Post/Custom Post types in Archive
- if there is only one post in the category, directly open
- WordPress categories being called “archives” in google links. How to remove?