You are using get_the_term_list
which generates an HTML string of taxonomy terms associated with a post and given taxonomy.
Try instead to feed the terms
input parameters of the WP_Query
with an array like:
'terms' => array( 11, 22, 33 ),
or
'terms' => array( 'term1', 'term2', 'term3' ),
In your code example you have
'terms' => $post_product
so you could use something like this
$post_product_terms = get_the_terms( $post->ID, 'product' );
$post_product = array();
foreach( $post_product_terms as $term ){
$post_product[] = $term->slug;
}
to construct the $post_product
array.
If you want to exclude some terms you can use
'operator' => 'NOT IN',
so your example could be:
array(
'taxonomy' => 'product',
'field' => 'slug',
'terms' => $post_product,
'operator' => 'NOT IN',
)
Related Posts:
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- Using wp_query is it possible to orderby taxonomy?
- “tax_query” parameter not working with WP_Query
- Custom Taxonomy and Tax_Query
- display posts with same taxonomy term
- Including all terms in wordpress tax_query
- Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
- search query within custom taxonomy term, post title and meta field
- Adding session variable and/or cookie based on user-selected input
- List taxonomy / category count showing list published posts only
- Advanced Tax Query
- why do drafts return as part of wp_query?
- WP Query with custom taxonomy
- Get pages only with a specific taxonomy
- Taxonomy archive showing no results
- Get taxonomy parent using child slug (from merged taxonomies)
- Hiding taxonomies with no children WP_Query & tax_query
- Set tax_query conditionally with new WP_Query
- How to do a particular wp_query taxonomy search
- Taxonomy.php how to show post only in current taxonomy with wp_query?
- WP_Query tax_query – Show results if child has parent X
- Query custom taxonomy for category including children
- how to use tax_query to apply both terms or one if one is empty
- how do you pull data from two taxonomies?
- How can I get all the posts that are related with a specific taxonomy term?
- WordPress hiding posts without content on custom taxonomy query. How to solve?
- Using wp_query is it possible to orderby taxonomy?
- How to limit posts to 1 from each term with tax_query?
- wp_get_object_terms count on taxonomies within an category archive
- How do I exclude a custom taxonomy from the post loop
- How to use taxonomies on attachments with the new Media Library?
- How to add images to taxonomies?
- WordPress tax_query “and” operator not functioning as desired
- Can you add the visual editor to the description field for custom taxonomies?
- Check if a post has any term in this custom taxonomy?
- custom post type taxonomy “tag” archive : no post found
- Add custom taxonomy fields when creating a new taxonomy
- Contact Form 7 – Populate Select List With Taxonomy [closed]
- How to display custom taxonomies in posts?
- Get taxonomy names by post id
- Creating Custom Taxonomy without mapping to any post type
- Using WordPress to make a “Product Search” type navigation drilldown
- Displaying the category name of a custom post type
- Why is my working Custom Taxonomy not in get_taxonomies array?
- Combine two taxonomies in a hierarchical tree
- Custom taxonomy hide meta box but show in menu
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- pre_get_posts with tax_query causes empty result
- Exclude specific slug in ‘get_terms’
- wp_insert_term – parent & child problem
- Is there a way to disable a term rather than deleting it?
- The Operator “NOT IN” Does Not Work In tax_query
- Widget to display custom taxonomy tag cloud
- Modify Term Update Redirection
- Display posts the match taxonomy term linked from wp_list_categoies?
- How to get first post in a category of a custom taxonomy
- Hook to process a new taxonomy tag before it is created?
- Return only the custom sub-term for custom post type, do not echo term-parent
- Get total number of comments from posts in a specific custom taxonomy
- Custom taxonomy on permalink
- Display one post from each term in a custom taxonomy [closed]
- Check if current term is a child of another term
- Custom hierarchal taxonomy loses interface hierarchy when selecting parent & children
- get_terms() doesn’t return empty terms even though hide_empty is false
- Why is my WP_Query not working when tax_query terms are an array?
- How do I filter posts by taxomony using AJAX
- SQL QUERY needed to get POST category (taxonomy) ? – MUST be SQL statement
- Remove Category description textarea
- Formating the_terms() function output
- Archive template for taxonomy terms
- Multiple users – only allow them to manage their own terms for custom taxonomy when logged in
- Custom taxonomy on users with UI
- How to return a list of custom taxonomy terms via the Gutenberg getEntityRecords method
- Create taxonomy with meta term using the WP Rest Api
- wp_options table value
- Custom Taxonomy Only Showing Top Level Terms in Admin?
- How can I set up a category “overview” page?
- Post tags saving as both tag name & tag ID on post update when tags are displayed as checkboxes
- Sort posts by number of matched terms
- Get current term’s ID
- Is it possible to get a Previous/Next Taxonomy term archive URL?
- wp query with multiple taxonomy?
- wp_query orderby title and meta key value (WP3.1)
- Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)
- How to get the parent’s taxonomy?
- On Taxonomy Template page, want to add Post_Type
- Page queried instead of a custom taxonomy
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Taxonomy Relationships
- Possible to register multiple custom taxonomies in one function?
- How to get the top most term (top ancestor) of a custom taxonomy child term?
- tax_query not working on main query
- Taxonomies not appearing in columns on dashboard
- Combine multiple custom user taxonomy in single url
- Custom WP_Query breaks default behaviour of viewing right post associated with tax-term!
- How to modify default taxonomy field to a single text field?
- The next_posts_link() show me a aditional page in blank
- Add custom taxonomy to default category taxonomy?
- How to set hierarchical terms to a post using wp_set_object_terms
- Help with a query not working with custom taxonomy