Add to $post_type
array, don’t replace it…
function dog_query_post_type($query) {
if( is_category() && $query->is_main_query() && empty( $query->query_vars['suppress_filters'] ) ) {
$post_type = get_query_var('post_type');
if($post_type)
$post_type[] = 'dog';
else
$post_type = array( 'post', 'dog', 'nav_menu_item');
$query->set('post_type',$post_type);
return $query;
}
}
add_filter('pre_get_posts', 'dog_query_post_type');
Related Posts:
- Filtering a custom post type by custom taxonomy in archive template
- Why are posts from custom post type not displayed in “category” archive?
- Displaying category archive of custom post types
- Regex problem in an add_rewrite_rule
- get_categories for custom post type and filter by custom taxonomy (brand) and list child categories of a defined category
- Category page only displaying the posts from a custom type
- custom taxonomy archive by year
- CPT Archive with core Category
- Custom Post Type Archive Page Filtering
- Archieve.php not loading for custom post type
- Archive Template being used instead of Category Template for Custom Post Type
- Menu’s breaking, now showing all page links on site
- Advanced archive url structure (category, tag and date)
- Display all Categories except ones with a specific parent
- Custom WordPress theme not displaying posts from category
- Adding Custom Post Types to category/tag/author archives breaks header content
- Custom category taxonomy – archive page not showing up
- How can I generate a list of post-type specific categories?
- Custom Post type archives / categories give 404
- archive.php can’t find categorized posts
- How can I set up the URL for a category archive for a custom post type?
- Categories in custom post types
- Stop header code from showing in category page?
- Exclude a category from WP_Query
- Custom Post Types on Category Pages
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- How to display regular posts & custom post types that fall under a category using just the generic category template?
- Setting up custom post type archives in WP3.1? Any luck?
- How to filter custom post types by custom category taxonomy
- How to show more posts on an archive page?
- How to list all categories and tags in a page?
- Pagination not working with custom category template
- remove support for ‘Categories’ for a custom post type
- Remove date and category filters when editing custom post types
- Display all custom post types in archives.php
- Custom Post Type Archives by Date (stored as meta value) WP3.1
- Multiple post types in archives (filter?)
- How to let custom post type posts show in standard post archive (like in homepage)?
- Automatic category for a Custom Post Type
- Custom post type archive sorted and grouped by date in post meta field
- How to display the categories of the post? (custom post type)
- Display Custom Category (taxonomy) Name in Custom Post Type
- Custom-post-type-archive: posts sorted/filtered by year?
- CPT posts listed by category with custom rewrite URL, please help!
- Multiple custom post type loops in category.php
- How to get the post type from a category id?
- Insert HTML inside link in a walker
- just can’t get date-based archives per post-type to work
- Set menu active state for custom posttype and category, given custom taxonomy term
- Getting posts under the custom post type ui category
- Separate custom categories from default category
- How to display custom taxonomies with links in filter menu?
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- Add custom post type settings to wordress default posts
- Hide parent categories when clicked, and show it’s childs
- How to get post type and month/year before while loop for date.php file
- Custom archive page for CPT UI
- Multiple (two) category postings on the same page.
- How to display custom post in archive section of the wordpress page?
- School & class blogs: Categorize with categories or custom posts?
- How to get custom posts sub category link
- CPT category hierarchy
- How can I have different content for different countries?
- Return the name of the post type
- Invalid Taxonomy
- archive as a page, so that it can be added in the wp_menu_nav
- custom query with custom post type and category slug
- Custom Post Type Archive Pagination
- Use post in multiple places on a page with multiple posts
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- Custom post type specific category box
- Custom Taxonomy Taxonomies of Same Name point to first created URL
- How can I allow users to edit text that will be displayed on a custom post type archive page?
- How can I increase the post count for custom post types only?
- category.php not showing custom post types
- Post category behave like a Post in back office menu
- Save data is post using php front end
- Custom Post Type Archive Page showing as 404
- Modify category permalink to use post type slug
- How to output custom post type title on custom page with category next to it?
- Create custom post type categories
- Set a Default CPT taxonomy by taxonomy id
- Automatic Set Category For A Custom Post Type
- how to create custom taxonomy drop downs for parents and child
- Only show categories that have posts within custom post type
- can’t see categories in appearance-menu-categories
- Custom nav menu current item custom link problem
- Custom Post Type + Category archive
- Stop Custom post type from being searched via URL
- Exclude categories For Custom post types
- archive-{custom_post_type}.php not getting recognized wordpress
- Show custom post type in archive page by category
- Display all post types together
- Trying to create hierarchy between 3-4 custom post types
- Displaying wp post categories into my custom metabox
- Display results from two Custom Post Types in page template
- WordPress custom post type post and category links 404
- One set of categories for multiple custom posts
- Choose custom post type template by category
- Are custom posts included when getting a categories’ posts?