That is the normal behaviour. If you go the archive of one taxonomy term you will get all posts, of any type, with this taxonomy term.
One solution can be, for example, adding ?custom_type=files or ?custom_type=questions to your URLs and alter the main query in the pre_get_posts filter:
add_action( 'pre_get_posts', 'my_pre_get_post' );
function my_pre_get_post($query){
if(!empty($_GET['custom_type'])){
//limit the filter to frontend, main query and archive pages
if($query->is_main_query() && !is_admin() && $query->is_archive ) {
$query->set('post_type',sanitize_text_field($_GET['custom_type']));
}
}
}
If you want to go further you can write custom rewrite rules and add query vars to have those URLs be “pretty”.
Related Posts:
- How to use a custom post type archive as front page?
- Combining queries with different arguments per post type
- How do you get the count of posts in an archive page?
- Mixing regular and custom post types (with meta_query) on home page
- How to make a WP_Query search with custom post types?
- $wp_query->queried_object->ID throws warning: Undefined property
- how to filter by last name for custom post
- The Operator “NOT IN” Does Not Work In tax_query
- Display Custom Post Type Fields
- Use WP_Query object inside a function
- WP_Query search custom posts meta date fields
- Get posts with tag all post types
- How to get_queried_object on multiple objects?
- How to get the parent’s taxonomy?
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- WordPress query by multiple Custom fields and order by date
- Help with hierarchical custom taxonomies and permalinks…almost there
- New WP_query in template not working with CPT+category on some pages
- query order by date on custom type: wrong order
- Displaying a specific post in a wp query by post id
- Query current and future events, ordered by begin date
- WP_Query search posts by custom post type and custom taxonomy
- Unable to get post content from custom post type loop
- How to dynamically attach pictures to a carousel
- Is it possible to apply a meta_query to one specific post type in a query with multilple post types?
- WordPress Orderby Numeric Value Not Working
- How to call a custom post type with WP_query
- How to add pagination to wp_query [duplicate]
- WordPress custom loop filter by meta_key and value with serialize data
- Show one item per category of a custom post type
- Storing posts from query and accessing later via AJAX call
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- Mixing 2 custom post types with posts output in specific pattern
- Show only one post on custom post type archive
- How can I made custom taxonomies relationship?
- Why is this query not working? (Standard posts + custom post type)
- Pagination issue on category.php using custom post type query
- First custom field value (out of several) displayed twice after query
- How to get all tags of a custom post type by id
- Limiting posts_join, where, etc to a specific WP_Query object?
- How to make WP_Query not to show irrelevant posts?
- Create an archive page for custom post type with custom taxonomy
- WP_query – Filter by tax_query and meta_query using multiple select
- Create a list of recent Custom Post Types posts
- Empty search input does not return all posts
- How to sort a WP_Query by a custom field AND ALSO filter by a different custom field
- Undefined $post in wp_query
- Adding Multiple Post Types to Query [duplicate]
- Get current user id
- WP Query results showing posts outside of category ID
- tax_query (if the terms are empty)
- List latest post out of 2 custom post types
- How to count other posts not having specific taxonomy terms?
- Group by custom field value (start and end times)
- Running a custom query inside another cpt single and trying to grab a variable
- Get posts by category name
- WP_Meta_Query object with conditionals
- How to properly use Categories with Custom Post Types
- Problem while filtering by ‘category_name’
- Displaying Portfolio Filter by Category Order (alphabetically)
- Custom Post Type Query W/Category Dropdown
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- Pin posts to top of custom loop
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- WP_Query get always custom post_type for first
- WP_Query – How To Query Only Custom Posts With No Children of Their Own?
- Foreach result into WP_query
- Query custom post type and custom field by URL parameters
- meta query multiple values for the same key
- Custom post types – meta_query: search lesson which starts sooner
- Wp Query sort order from custom MetaBox
- Custom Taxonomy – fields
- CPT Loop, include taxonomies and disclude others?
- Custom Post Type Query by user id
- Query posts based on user preferences
- CPT post doesnt shows tags and category on backend admin page
- Adding a nav menu for a custom post type
- How to use costum database table for custom post type
- Most efficient way of showing children posts?
- Querying, storing, and using data from 2 separate custom post types
- date_query won’t accept day parameter, but will accept month and year for a custom post
- How can I use WP_Query argument ‘Like %..%’?
- Custom post type and custom taxonomies display
- WordPress custom post type
- Custom Post ‘Post Per Page’ Crashing Page?
- Issue with permalinks for custom post type
- Query child posts on parents single.php?
- Paged within a custom content type template [duplicate]
- WordPress can only query up to 766
- Custom Post Query Combined with Conditional Tags
- Custom loop won’t work, can’t find problem
- Query by post type or category
- Customising wordpress search and using $_GET[“s”]
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- How to exclude certain portfolios from a loop
- show the most recent date of all posts to display on front end
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- How can I show posts with the same tag?
- Load posts via AJAX without draft status
- WP Query – Can’t get posts with specific taxonomy