Your problem is your use of query_posts()
. Don’t use query_posts()
, ever.
Filter pre_get_posts
instead. For example:
function wpse74093_filter_pre_get_posts( $query ) {
// First, make sure we target only the main query
if ( is_main_query() ) {
// Target the category index archive,
// and only for the category "client-x"
if ( is_category( 'client-x' ) ) {
// Set the post-type to "project"
$query->set( 'post-type', 'project' );
}
}
return $query;
}
add_action( 'pre_get_posts', 'wpse74093_filter_pre_get_posts' );
I’m assuming the appropriate category term is client-x
, based on the category archive index URL in your question. If that’s not the right category, replace as appropriate.
Related Posts:
- Why are posts from custom post type not displayed in “category” archive?
- How can I list all the categories under a Custom Post Type (taxonomy)?
- category__in not working on custom post type
- how do I group content in magazine-style ‘issues’?
- Use standard WordPress categories with a CPT
- Regex problem in an add_rewrite_rule
- Categories or Custom Post Type to Organize Content
- How can I add single catogory for custom post type?
- On clicking on the category name the page is redirecting on 404 pge
- Hook onto Add New Category
- Custom edit post column – category not showing
- Get the post_type of current taxonomy or category page
- Custom post type taxonomy template
- Categories and Tags not working!
- automatically save custom post type title as a category
- get_categories for custom post type and filter by custom taxonomy (brand) and list child categories of a defined category
- get_categories() for only CPT
- Category page only displaying the posts from a custom type
- Get a permalink structure of /%posttype%/%category%/%postname%
- Search doesn’t find tags or categories in custom post types
- Querying Term Posts in Loop
- Get Post Primary Category
- Pagination on category page with custom post types
- Call custom post type by category
- Add category attribute to custom shortcode
- Should I use custom menu, C.P.T. or theme options, or something else for this?
- Posts from all the categories are being displayed instead of particular category
- Conditional Statement custom post type category
- Show custom post type filtered by category
- forming WP_Query for posts of all post types but from specific categories
- PHP variable not regenerating when publishing multiple posts at the same time
- Filter CPT posts by one or more categories
- Custom Post Types with a common category for a blog listing
- WP Query with categories only shows one post and ignores the category
- Custom Post Type + Categories
- Hierarchy and access control for Custom Post Types (CPT)
- Loop filtering Custom Post Types and/or Categories
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- How can I show 1 featured post in a styled element, and the next few below differently styled
- How do you create a custom template to display a category with an image and related posts below?
- How can I list Custom Post Types created with the Types plugin under categories?
- Category.php template for custom posts
- Categories and tags for custom post types
- Category archive in with conjunction with custom post type is empty
- How to add current custom taxonomy slug to body class
- Meta data (Tags and Categories) for Custom Posts not showing.
- List Posts By Custom Taxonomy
- How to Display Posts From Category Within a Custom Taxonomy?
- Custom post types with categories in template
- Category Icon on custom post type
- The Difference Between Categories and Tags and Taxonomies and Terms
- Get assigned post categories
- Default Category Page not showing custom post type which has taxonomy category
- Custom Post Type posts not showing in category
- Post Query not working
- Get child categories of custom taxonomy category?
- Create query for both custom post type and category
- Get terms for a specfic post from multiple taxonomies in custom post type
- Category Name with Custom Post Type
- Am I mixing up the concept of posts pages and categories?
- Custom post type, taxonomy and admin bar
- CPT archive page – show one post from each taxonomy term
- how to organize my categories or should I do custom post types for some?
- Order Categories by Hierarchy?
- Multiple categories assigned to a single product breaking the breadcrumb
- How to divide Subcategories into pages of parent category wordpress
- Display all Categories except ones with a specific parent
- Custom front-end form for adding post – Category problem
- Custom Post Type Category Displaying ALL Sub Categories as well
- Control over custom post types on a specific page
- create a “add icon” field in taxonomies page
- Feature image Gallery made from Custom Post type + Categories
- Show Custom Post Type based on Category on Archive Page
- Convert With Custom Post Type
- Get meta values from parent post and save in child post
- Custom category taxonomy – archive page not showing up
- Use Category for Custom Post Type – But Need Another Separate Archive Page too
- Only show current category post
- Custom post type category archive URL redirects to home page
- how to use two permalinks for one custom post type based on categories
- Structuring 3K pages in WordPress
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Display 2nd category, only once, as sub-heading, in the loop
- archive.php can’t find categorized posts
- Custom Catagory not found
- Page to show custom posts and one category
- wp_list_categories() with attachment post types
- How can I list custom post by custom category?
- How can I set up the URL for a category archive for a custom post type?
- how to show perticular category posts in custome page
- Use only selected regular categories for a Custom post form
- Bulk remove category from custom post type?
- Page that ‘subscribes’ to multiple categories
- Problem with menu categories doubling up when updating database?
- Custom Post Type or just Post Categories?
- Remove slug from Custom Category Permalink + dual-category permalinks
- How to query posts by category with the_title();
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- Get all posts of any post type in a category from REST API