It looks like your query is for ALL posts in that post type as you are overwriting $posts
when using $posts = get_posts()
.
You need to pass the Taxonomy parameter correctly as explained here like this:
$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'people',
'field' => 'slug',
'terms' => 'bob',
),
),
);
$query = new WP_Query( $args );
You need to modify your code along those lines. So maybe change $posts = get_queried_object()->term_id;
to $termID = get_queried_object()->term_id;
and use that in your tax_query
Related Posts:
- SQL to update custom post taxonomies
- Query multiple taxonomy in Custom Post Type
- Querying Posts by Taxonomy From Alternate Network Site
- Include different loop templates in search query
- WP_Query search posts by custom post type and custom taxonomy
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Show Two custom Post type and their posts on category page
- How to filter custom taxonomy categories on archive?
- Querying Term Posts in Loop
- Am unable to reset a query properly
- Get next and previous 3 posts in a term in single post page
- Making certain categories of CPT not publicly queryable
- Search / Filter posts on Title/Content OR Tags
- Get parse_query filter to return slug instead of id
- How do I move/order posts with a tag to the end?
- Specific query for custom post type
- Display post content with respect to its title?
- First custom field value (out of several) displayed twice after query
- WP_Query orderby and tax_query
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- WP_Query() with custom post type and taxonomy — get all terms?
- Can I query posts by taxonomy conditionally based on post type?
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- Custom Post Type not showing in main loop
- Custom taxonomy query showing more than 4 posts
- Custom types, taxonomies and query optimization
- Query Custom Post by taxonomy multiple categories
- Query custom posts from custom taxonomy
- How to divide Subcategories into pages of parent category wordpress
- Check that a slug is present in the get_terms request
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Displaying all posts by category and showing content on click
- I have a random letter appearing before my content. Where to start looking for the cause?
- WP_Query for custom taxonomies showing posts from non-specified terms?
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- Get posts of an specific term of a custom taxonomy
- Query Pulling the same post twice
- Query Only Show Text on Posts With Certain Taxonomy Tag
- how to limit query_post to first page?
- Listing custom post type items from a couple of custom taxonomies
- Custom taxonomy not showing up when adding a new custom post type
- query multiple taxonomies
- wp_set_object_terms() is not replacing term, but creating a new one
- Create an archive page for custom taxonomies
- Rewrite permalinks for custom posttype and custom taxonomy
- How to check if last uri segment is a custom post type or taxonomy term?
- Categories under custom post types doesn’t show properly
- get a list of posts from Custom Taxonomy
- Trying to manage templates on a blog with lots of custom taxonomies
- Having trouble with custom date field for CPT query (WordPress)
- Display Custom Category (taxonomy) Name in Custom Post Type
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Custom post type and taxonomy permalinks – Structure
- Best action hook to create custom post and assign taxonomy terms to it on plugin activation?
- Use get_post_types to query only custom posts types
- How many Custom Post Types to register?
- Set menu active state for custom posttype and category, given custom taxonomy term
- How to bulk copy custom fields between custom posts?
- Custom post type structure for posts with multiple child posts
- Hide parent categories when clicked, and show it’s childs
- Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy
- Auto Complete Search
- permalink /category/post-name with custom post type and taxonomy
- Displaying Custom Taxonomies From Multiple Custom Post Types
- Display and register custom categories for custom post types
- Properly flush rewrite rules on plugin activation
- Adding predefined terms to a taxonomy
- Redirect to archive is single post has a certain term assigned to it?
- Custom taxonomy page returns 404
- portfolio custom type tags support
- Custom taxonomies to define versions of a product
- Targeting custom post type via functions.php doesn’t work
- Function to limit number of custom post types on homepage – TwentyTen
- Get custom category ID of current custom post within the loop
- Add filter to Admin list for all custom post types by their custom taxonomies
- Single.php for Custom Post Type > Taxonomy > Term
- Displaying custom taxonomy menu in custom post type archive
- Custom post types templates
- prevent sub categories to show up
- Add custom post type to query
- Custom post type category link redirecting to 404 page
- Archive page URL for custom taxonomy and post type
- WP Query from two Custom Post type fields as statement
- Custom Post Type Archive Page showing as 404
- Multiple Custom Post Type in Taxonomy Archive Causing White Screen
- Adding a Section for Visitors
- Remove CPT Slug with 2 taxonomies and 1 post meta
- Posts show up under “published” but not “all”
- Associate custom categories to different user IDs
- archive-{custom_post_type}.php not getting recognized wordpress
- How to retrieve the permalink for a specific (custom) term?
- Values inside a custom field to determine which category posts to display
- Taxonomy and Rewrite Structure
- Pagination for a Custom Taxonomy
- Trying to create hierarchy between 3-4 custom post types
- 404 for children in hierarchical custom post type
- Only One Post of Custom Post Type Appearing on Template Page
- Code to show related posts (custom post type and custom taxonomy/category) is messing with other code
- register_term_meta not working
- Dynamically count the number of custom post types associated to a custom taxonomy