You were close with the code you posted in your comment. The issue is that you only tested for is_main_query
, which will limit every query on your site to that single post type.
function wpa82763_custom_type_in_categories( $query ) {
if ( $query->is_main_query()
&& ( $query->is_category() || $query->is_tag() ) ) {
$query->set( 'post_type', array( 'post', 'resource' ) );
}
}
add_action( 'pre_get_posts', 'wpa82763_custom_type_in_categories' );
Related Posts:
- Custom post type loops with different page templates
- Main query not querying any posts in custom taxonomy template
- Control content before and after custom post type loop
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- Create a custom taxonomy template that loops through child categories in term order?
- Accessing download link from the loop with WP Download Manager Pro
- Combine multiple separate lists into one
- Show parent category and subcategory once in while loop
- Custom taxonomy template for custom fields loop [closed]
- Add active class to foundation 6 tabs while looping categories
- WordPress query posts by custom post type not workng
- WordPress Custom Post Type and sort by Tags
- Order by custom field attribute
- Looping taxonomy in taxonomy?
- Taxonomy, Terms, and Template Files
- Get Custom Taxonomy ID within loop
- Get page by template?
- Get custom post type by category in a page template
- Categories under custom post types doesn’t show properly
- Custom Post Type Archive Template
- Posts in Multiple Columns and Rows with one single loop
- List all posts in Custom Post Type but group dynamically by Custom Taxonomies
- Clean URL permalink for custom post type
- How to display the rest of categories on Portfolio filterable
- Trying to manage templates on a blog with lots of custom taxonomies
- Append taxonomy terms as class names in markup?
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- How to append element after thumbnail
- ‘category__and’ for custom taxonomy?
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- How to output wordpress custom tags separated by comma?
- Normal pages as children of my Custom Post Type
- Only show posts from a certain category?
- get_posts of Custom Post Type AND Custom Taxonomy
- Custom Post Type Loop throws 500 error when used in widget
- Received nothing after executing AJAX post function
- Custom loop with multiple taxonomy queries
- Displaying CPT and custom taxonomy side by side in Bootstrap 4 component
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Group CPT posts by custom taxonomy
- Categorize custom post type
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Display Custom Taxonomy Alphabetically
- Listing all term items alphabetically / sorting loop
- Display related custom taxonomy posts in sidebar
- How can I get this request to use the Custom Post Type page template instead?
- Archive for a Taxonomy of a Custom Post type
- Get term name without a foreach loop
- Including all post id’s of a custom post type into an array
- Using wp_query to modify the loop in index.php for a CPT
- Get custom post type categories to show up in menus
- looping though custom post types and only return results in a given taxonomy
- Which file/template is in charge of taxonomies for custom post types?
- Dynamically insert code to custom post type loop
- Show current custom taxonomy
- get_terms() parent, child and grandchild
- List all Custom Post Type posts excluding certain Taxnomy term
- Looping through custom taxonomy and display custom post types (Custom Post Type UI)
- Loop and add Specific Categories and Products Images
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- How can I increase the post count for custom post types only?
- On click some element i want to use some template
- Page that lists publications by classifying them by taxonomy
- Custom post type paging return home page
- Assigning categories to custom post types via a front-end form; only works for native post type
- when looping through custom post data not appearing
- Load info from customposttype into template page
- Custom Post Type has wrong label and is not found when called by a loop
- Taxonomies are not showing in the category dropdown
- Multiple Custom Post Type in Taxonomy Archive Causing White Screen
- Adding a Section for Visitors
- Why is my loop not populating the page with my custom taxonomy terms from my custom post type?
- List all posts associated under custom taxonomy
- Custom Taxonomy – fields
- Custom taxonomy with custom post type template not showing
- Loop to display parent categories in custom taxonomy
- How to show terms used only for particular custom post type. Filter creation perpose
- Single taxonomy for different custom post types
- Display related post content and custom field content
- The most recent post of custom taxonomy
- Show tags of custom post types in WordPress
- How should i name the .php file to show custom posts under a taxonomy’s term?
- Show posts for current taxonomy
- Custom post type with custom taxonomy permalinks
- template structure for CPT not clear
- Loop multiple taxonomy in custom post
- Post data in separate divs with incrementing class using WP_Query
- Values inside a custom field to determine which category posts to display
- Posts without featured image using other post’s featured image
- Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax
- Listing all custom post types using a specific term on the said term’s template page, in groups
- Loop through multiple custom taxonomy terms and display posts for a custom post type
- Only One Post of Custom Post Type Appearing on Template Page
- display custom post type from register taxonomy
- Get all active posts that are tied to a custom taxonomy for a custom post type
- How do loop categories post from according in WordPress? is it impossible to solve this problem?
- I want to show image from custom field image on my custom page template
- Create a WordPress loop that shows posts from a custom post type + filters the posts by taxonomies while hiding empty taxonomies
- Add Custom Taxonomy Terms as CSS Classes for CPT Posts in an Elementor Loop Item Template