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
- Contact Form 7 – Populate Select List With Taxonomy [closed]
- Why is my working Custom Taxonomy not in get_taxonomies array?
- Display posts the match taxonomy term linked from wp_list_categoies?
- Create taxonomy with meta term using the WP Rest Api
- Page queried instead of a custom taxonomy
- Taxonomies not appearing in columns on dashboard
- Echo taxonomy term meta on author.php
- Hierarchical display of custom taxonomy
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- How to output the taxonomy term name in a widget
- tax_query shows no results if nothing is selected
- Is It Possible To Have Shared WordPress Custom Post Types?
- WordPress renames slug of tags used in multiple taxonomies?
- how to search in custom fields & custom taxonomy for custom search
- Show Post Count of a Category
- get_terms: determine if taxonomy term has children
- Order taxonomy terms in alphabetical order
- Set a taxonomy as private
- “show option all” on list categories doesn’t display taxonomy
- meta_key & meta_value not working with get_pages and custom taxonomy
- wp_insert_post not updating custom taxonomy selected if logged in as a subscriber
- Taxonomy template shows only 10 posts
- How to Filter custom post type by taxonomy?
- Extend & Search Native WordPress Image Galleries With Tags and Taxonomies?
- How do I display the grand child items of a taxonomy term?
- Custom Taxonomy index/archive hierarchy
- Filter custom taxonomy archive posts by 2nd custom taxonomy using select dropdown
- How to show all post related taxonomies
- Getting associated taxonomies
- wp_query args adding muitiple tax_querys
- querying posts by custom taxonomy terms right from a querystring based URL
- Custom taxonomy.php not working
- Get the taxonomy of the post
- Taxonomy Meta Box in User Profile?
- WP_Query for a taxonomy with different taxonomy types
- How Parent Taxonomy automatically added to the post when using `wp_set_object_terms()`?
- Get object for a few selected taxonomies
- Using WP_Query and Query_post for the loop?
- Problem with wordpress pagination
- How to add custom meta to ‘pre_get_terms’?
- Loop through custom taxanomy in post and display custom fields from posts
- query_posts that have custom taxonomy and limiting what shows based on the taxonomy
- “Menu order” being ignored when querying posts from a parent taxonomy with “include_children” set to true
- custom post type and a “sticky” position taxonomy
- Rewrite Search URL Permalink For CPT Custom Taxonomies
- Template taxonomy-{taxonomy}.php doesn’t show my posts
- Tax-query on taxonomy doesn´t work
- WordPress search query, how to modify the sql
- Unregistered taxonomy apears still as emtpy filter list
- Get Highest and Lowest get_term_meta() value from Taxonomy Term
- Custom Taxonomy Not Being Recognized by is_tax()
- Ignore punctuation marks in taxonomy order by name
- How to truncate the description in the admin panel for a custom taxonomy
- How to combine nested tax_query logic with other nested query logic?
- Resize $term attachment using url
- tax_query not working for taxonomy slug
- Custom taxonomy escaping html attr
- Showing list of custom posts of a custom taxonomy
- Show portfolio category slug in url ( if exist)
- switch statement for taxonomy content
- How do you search for a post by custom taxonomy?
- tax_query showing no results
- Index page of posts tagged with two separate taxonomies
- How to display elements of different post types?
- Select default taxonomy on dropdown
- WordPress Taxonomy Menu
- get_terms() – unexpected ‘=>’ (T_DOUBLE_ARROW) error
- get_term_children specific no id
- Custom query for certain post type OR another post type with a certain category
- Add text in custom taxonomy
- How do I check if a post has a term with a particular ancestor/parent?