I found out that I was using pre_get_post on these pages to exclude some things on the taxonomy archive pages.
add_action( 'pre_get_posts', 'exclude_cpt' );
function exclude_cpt( $query ) {
if ( $query->is_tax('results_categories') ) {
$query->set( 'post_type', array('results') );
}
return $query;
}
BUT I forgot to make sure this was only happening in the main query, the final function is below.
add_action( 'pre_get_posts', 'exclude_cpt' );
function exclude_cpt( $query ) {
if ( $query->is_tax('results_categories') && $query->is_main_query() ) {
$query->set( 'post_type', array('results') );
}
return $query;
}
Related Posts:
- Query multiple taxonomy in Custom Post Type
- Get the most popular terms for a custom post type
- Order By Post Type ThenBy Taxonomy
- Custom query to filter posts that have current post as a taxonomy [closed]
- How to organise this data within WordPress
- Shortcode to return single custom post based on post taxonomy
- Custom taxonomy query showing more than 4 posts
- WP_Query for custom taxonomies showing posts from non-specified terms?
- How to get all taxonomies of a post type?
- Pagination not working with custom loop
- Renaming Custom Post Types and Taxonomies
- get_terms by custom post type
- Saving Taxonomy Terms
- Get Posts by Custom Post Type ,Taxonomy, and Term
- Custom Taxonomy as checkbox or dropdown
- Taxonomy: Why ‘with_front’ => false DOES NOT WORK?
- How to change permalink structure for custom post type and it’s taxonomies?
- Get the first post term
- Get the ID of the latest post
- How do I append multiple taxonomies to the URL?
- Custom Taxonomy as Dropdown in admin
- Custom Post Type Archives by Date and Taxonomy
- Sort custom post type list table by display name of a user id stored as post meta value
- How to use a custom post type as front page?
- Creating “static” taxonomies to choose from, inside custom post type?
- How do I dynamically populate wp_nav_menu from a custom taxonomy?
- Custom Taxonomy’s Label to change the text appearing in Appearance > Menu
- How to completely disable a taxonomy archive on the frontend?
- Random post, once per day
- get attachments for all posts of particular post type
- How to limit the number of terms (terms acts like categories)
- Taxonomy count per Post type
- Custom Post Type – Taxonomy Dropdown Menu?
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Query custom post type by custom field
- Taxonomy term in permalink
- How do I display two separate taxonomy archives for two post types that share a single taxonomy?
- Custom taxonomy not showing up when adding a new custom post type
- How do I list custom taxonomy terms without the links?
- How to list custom taxonomy categories?
- Custom Taxonomy Template Post List with Sort Order
- Query Custom Post Type taxonomy type based on page
- Add Custom Post Type to Current Query
- wp_insert_term doesn’t work with custom post type’s taxonomy
- How to list all categories and tags in a page?
- show tags of custom post type ONLY
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Taxonomy + post_type
- Remove quick edit for custom post type
- Using 1 taxonomy for multiple post types?
- Count posts that have specific taxonomy term attached
- Retrieve single term slug
- Taxonomy archives based on Custom Post Type
- Filtering Posts by Multiple Taxonomy Terms such as in an Admin Post Listing?
- Disable Single Post View for Specific Taxonomy on Custom Post Type
- Order Posts by Taxonomy and Meta Value
- How to set individual capabilities on a taxonomy? Or how to re-register an existing taxonomy?
- Create an archive page for custom taxonomies
- Get the ‘slug’ of a custom taxonomy
- Taxonomy page returns 404 page not found
- How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?
- Taxonomy terms with edit/filter link in wp-admin, in the list of custom posts
- It is possible to get a list of post types asociated to a taxonomy?
- display multiple term post from taxonomy in a single page
- How would I leverage custom Taxonomies in this scenario?
- List taxonomies with thumbnails
- How can you make permalink work for custom post type and taxonomy?
- Custom Metabox with Taxonomy Dropdown – Saving Issue
- How to get a list of term names of the custom post type im currently on in single.php
- How to show term-specific post list, without posts associated with child terms?
- Group list of posts by taxonomy and allow for pagination
- Custom Post Type with Custom Title
- SQL to update custom post taxonomies
- Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url
- How to get the parent’s taxonomy?
- Internationalize / translate custom post types & taxonomies
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Querying Posts by Taxonomy From Alternate Network Site
- Custom Search | Wrong output & question
- Rewrite custom post & taxonomy to share same URL path
- Group Custom post type in a page by its taxomony tag
- create a back-end wordpress content submission using custom post type
- Disable WordPress Recognizing Path as Attachment
- Query by 2 values of a repeater ACF field
- Include custom post type in “all posts”
- How do I list terms of a custom taxonomy at i.e. domain.com/brands/
- Same base slug for CPT post and CPT taxonomy terms
- show posts only on homepage but using custom post type and taxonomy for query posts via url
- wp_insert_post custom taxonomy
- Displaying related posts in a custom post type by a custom taxonomy
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- WP insert post PHP function dynamically generated Custom Fields
- Add Taxonomy Values Within a Custom Post Type RSS Feed
- Include both default and Custom Post Type in query modified inside pre_get_posts
- Custom Post Type: How to display all of same taxonomy?
- Taxonomy-{taxnonomy}.php is not working
- Query posts between two dates (custom meta keys) CMB2
- $wpdb returns no results with SELECT query on custom post type, works on default post type
- Display taxonomy term only if there’s a value