Hooking the following function with the pre_get_posts
filter will add one or more CPTs to the regular archive pages:
function wpse94041_cpts_in_archives( $query ) {
if( is_category() || is_tag() ) { // more conditional tags possible, if applicable
$query->set( 'post_type', array(
'post',
'tutorial' // add as many CPTs to this array as you like
));
}
return $query;
}
add_filter( 'pre_get_posts', 'wpse94041_cpts_in_archives' );
Your theme’s functions.php file would be a good fit for the above.
Related Posts:
- Slug for standard post post_type
- Display all Categories except ones with a specific parent
- How to achieve a multi-taxomony layout with posts?
- How to make a list of posts displaying them 5 by 5 with a “next posts” link?
- Front end post editing using a form
- Filtering a custom post type by custom taxonomy in archive template
- get term archive url / link
- How to get the custom post type from an archive page?
- Set posts of a custom post type to be private by default?
- Proper way of making custom post type landing page or archive page
- How make get_next_post() return first post when viewing last one
- Custom Post Type Archives with 0 Posts Redirects as 404
- Archive page with multiple taxonomies rewrite
- Archive page…limiting posts per page
- WP 3.1 – archive pages for custom content types possible now without a plugin?
- Date archives for custom post type
- modify all posts of a category to “no comments allowed”
- Getting a div content of a post in wordpress?
- How can I add dropdown widget/box to admin post page?
- Custom permalinks – post type – hierarchical taxonomy’s
- Downsides to not using built-in “Posts” post type?
- get_page_by_title() not returning anything [closed]
- Category and post tag archives do not include posts from custom post type
- How to list custom post types?
- get_queried_object error How to show post count by month in the taxonomy page
- How to create A-Z index listing for custom post types?
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- How to post twitter like updates on wordpress
- How Can I Set the Post Author of a Post I Just Created With PHP?
- WordPress Orderby Numeric Value Not Working
- Deleting Custom Post type data using mySQL command
- Notice: Undefined index: suppress_filters
- Custom Post Type Archive Page Filtering
- Storing posts from query and accessing later via AJAX call
- If post has custom field then display css-class
- Missing Posts in Custom Taxonomy List
- How can i add thumbnails images to particular post (using code not admin pannel) in wordpress
- Create template for taxonomy results limited by Custom Post Type
- Showing posts from different categories and from custom post type
- custom post type category count shortcode
- Add post location with mile radius allowing search
- Custom Post Slug same as Parents Category Slug
- How to integrate a form (Ninja Form or Contact Form 7) with Custom Post Types?
- How to get all tags of a custom post type by id
- How to define which register_post_status goes to which register_post_type?
- Is it better to use filter for the_content in archive pages?
- Create new custom post and post category of same name
- Archive not sorting correctly
- Load Next WordPress Posts With AJAX?
- What’s the name of the custom post type yearly archive template?
- multiple custom post type on category page
- If there is only one post (show elements) else (show other elements)
- Can anyone clarify difference between archive-{posttype}.php, type-{posttype} and date.php?
- Custom post type menu
- How do I add custom HTML to the content of an archive page’s posts?
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- Use the custom post type archive for taxonomies?
- Modify Posts from Custom_Post_Type within the plugin
- How do I edit the WordPress post.php file?
- Posts are not rendering perfectly [closed]
- List all posts in taxonomy term
- how to redirect to a custom post template
- How can I tell if I’m on a custom post type archive page?
- list articles in admin showing nested categories or slugs?
- Search CPT by tag ids
- Post template with breadcrumb needs to show page navigated from
- Define multiple prefixes for custom post type
- Publishing failed. The response is not a valid JSON response
- add all blog posts to folder
- Show posts from WP Custom Post Type selected from a field in a metabox
- order custom post type posts by custom date
- Custom WordPress theme not displaying posts from category
- How to show posts of the same category on a page?
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- Order archive custom posts by taxonomy term [duplicate]
- call a function when insert and update a custom post type
- Work and Display a Custom Post Type as a normal Post
- Most efficient way of showing children posts?
- Custom post type with two templates
- One Post with different content, depending on a Page
- Custom Post Type tag taxonomy “Page Not Found”
- Custom Post Type
- Popup panel is only displaying 1 entry ignoring all others
- Custom Post Status & Taxonomies
- Custom Post type archives / categories give 404
- How to display data with pagaination on backend?
- Edit post meta direct from post.php?
- How to Arrange Support => Thumbnail
- Archive.php is not displaying tags
- Front-end form submission not creating post
- Custom post type category page not working
- Post being scheduled that shouldnt be schedulded
- paging is not working properly on news archives page [duplicate]
- Categories in custom post types
- is_singular won’t call my functions?
- How to turn custom-post archive into an overview page, listing the metadata of the posts?
- Remove plugin’s custom post type archive page and single pages [closed]
- Get custom post type parent category
- show the most recent date of all posts to display on front end
- Sort ACF by custom taxonomy