I solved it:
Just in case anybody ever has any trouble querying a post with the same term
of a Taxonomy
in another Post Type
. I’ll post my answer below because I finally solved it on my own.
<?php
$terms = get_the_terms( $post->ID, 'supplier-tax');
foreach ( $terms as $term ) {
$termID[] = $term->term_id;
}
$the_query = new WP_Query( array(
'post_type' => 'supplier',
'tax_query' => array(
array(
'taxonomy' => 'supplier-tax',
'terms' => $termID,
)
),
) );
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<p class="supplier">Supplied by <strong><?php the_title(); ?></strong></p>
<img src="https://wordpress.stackexchange.com/questions/196832/<?php the_field("logo'); ?>">
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
I hope this helps someone because this was hard to find a solution too.
Related Posts:
- Querying Posts by Taxonomy From Alternate Network Site
- 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?
- Querying Term Posts in Loop
- Search / Filter posts on Title/Content OR Tags
- First custom field value (out of several) displayed twice after query
- WP_Query orderby and tax_query
- WP_Query() with custom post type and taxonomy — get all terms?
- Query custom posts from custom taxonomy
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Get posts of an specific term of a custom taxonomy
- Display all posts in a custom post type, grouped by a custom taxonomy
- Exclude a category from WP_Query
- How to use a custom post type as front page?
- query multiple taxonomies
- Custom Taxonomy with Custom Post Type Finds No Posts
- Custom query – alternate posts by category
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- how to group custom post type posts by custom taxonomy terms
- SQL to update custom post taxonomies
- Query multiple taxonomy in Custom Post Type
- Sort the main query in subcategories/terms?
- Query by 2 values of a repeater ACF field
- Custom Taxonomy List links being re-written
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Include both default and Custom Post Type in query modified inside pre_get_posts
- Want to filter only parent post in admin area
- Multiple Archive Pages for Custom Post Types AND Taxonomies
- Exclude current post when getting related post on custom post type and taxonomy
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Ordering Custom Post Types with WP_Query
- Having trouble with custom date field for CPT query (WordPress)
- Custom post query by taxonomy
- Querying CPT with Two Taxonomies
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Custom Query to display posts with custom field
- Get taxonomy description based on variable
- Conditional to modify query results
- Show Two custom Post type and their posts on category page
- Use get_post_types to query only custom posts types
- Group custom posts by custom taxonomy names
- How can i skip same post from taxonomy term?
- Filter by custom taxonomy slug on a custom post type
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Pagination : How to remove /page/x/ after a ‘POST’ action on a form returning to page 1
- Am unable to reset a query properly
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Get next and previous 3 posts in a term in single post page
- wp_query check if integer exists in custom field’s array
- Wrong request query on cpt and tax
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- Custom-Posttype & Custom Taxonomy WP_Query
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- What’s the WP way to load remaining custom posts?
- Query Custom Post Type Taxonomy term with multiple parameters
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Retrieve custom post types by custom taxonomies with WP_Query
- Using page slug in wp_query
- Custom taxonomy wp_query woes.
- Creating two loops based on different logic
- Different options per post type in WP_Query
- How to show all taxonomies within custom post type loop
- Returning a custom content types with meta values
- Custom Category Walker with Image, Fallback to Most Recent Post in Category Image
- Custom Post Type not showing in main loop
- Exclude latest post from WP_Query taxonomy term loop
- How to query Posts from a custom post type which contains a custom taxonomy?
- Create query for both custom post type and category
- Query Posts that have Custom Taxonomy
- Custom taxonomy query showing more than 4 posts
- Foreach loop returning more than one item when querying taxonomy
- Query Custom Post by taxonomy multiple categories
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Display featured posts for a custom post type by taxonomy
- What is the most efficient way to execute recursive complex queries?
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Sorting the Loop by Taxonomy Value
- custom taxonomy pagination 404 error
- Ordering by meta value not working
- have to do a while have post to show for two custom post types sharing the same taxonomy?
- Check that a slug is present in the get_terms request
- display post count in archive page that have relation with another taxonomy term
- WP_Query with all posts in one custom post type and only posts in another custom post type with a specific category
- Query a custom taxonomy in a function to create an csv file
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Conditional posts in WP_query for search
- Checking Taxonomy Terms for a Custom Post Type With get_the_terms Not Working
- Get posts associated with custom taxonomy alternate way
- Loop with Custom Post Type and Taxonomies
- tax_query showing no results
- How to display elements of different post types?
- Listing all custom post types using a specific term on the said term’s template page, in groups
- Filter Custom post type by another Custom post type
- Attaching multiple custom taxonomies to one CPT?
- Get X posts with the same terms as the current post (custom post type and custom taxonomy)
- Sort ACF by custom taxonomy
- Complex Custom Loop with Includes
- Dynamically count the number of custom post types associated to a custom taxonomy