Ok, found it, sorry for the noise !…
//fetch the terms of my tax
$terms = wp_get_post_terms( $post->ID, 'tool');
$terms_ids = []; //an array, which can contain several terms
foreach ( $terms as $term ) {
$terms_ids[] = $term->term_id;
}
// Query
$args = array(
'post_type' => 'technical_post',
'posts_per_page' => 4, // How many items to display
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'tool',
'field' => 'term_id',
'terms' => array($term->term_id) )
),
);
// Query posts
$tech_query = new wp_query( $args );
// Loop through posts
foreach( $tech_query->posts as $post ) : setup_postdata( $post );
the_title();
// End loop
endforeach;
// Reset post data
wp_reset_postdata();
Related Posts:
- Retrieve posts by term id custom query
- Display category posts grouped by taxonomy
- restrict_manage_posts not working in 3.3.1
- Filter all queries with a specific taxonomy
- wp_query orderby title and meta key value (WP3.1)
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Taxonomy.php issue with search and filters
- How to List Parent Term Links for Custom Taxonomy With & Without Children?
- Recreating the hierarchy of taxonomies for a dropdown form menu?
- Custom taxonomy query not working with switch_to_blog
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- Print terms with taxonomy and metabox value
- Checkbox onclick filtering on the same page
- A way to query custom taxonomies by name
- get the taxonomies terms associated with users
- Rewrite Rules returning wrong data
- Sorting main query by custom taxonomy slug
- WordPress Custom post query sorting does not work
- List related terms + taxonomies
- Search Query for Multiple Terms In Same Taxonomy
- Exclude taxonomy term from all loops, but having it on widget
- Get list of taxonomies associated with users
- query_posts that have custom taxonomy and limiting what shows based on the taxonomy
- Several taxonomy query (like filter)
- Taxonomy archive template that shows posts from more than one taxonomy
- how to access the $query variable inside taxonomy-xxx.php template file?
- Displaying Posts Attached to Custom Taxonomy Terms
- Update Custom Taxonomy Value for a post based on custom date field
- Get 1st parent category id from post
- How to get the term description in a taxonomy term archive query?
- making an index from custom taxonomies and tags of posts (not hierarchical taxonomy)
- Query Multiple Custom Taxonomies
- Query by multiple custom taxonomies
- WordPress search form and search result through ACF field in custom taxonomy
- Query pages by child term
- Can I use multi (sub) levels of relation (AND | OR) on custom query?
- Tax Query not working
- Custom taxonomy – query returns an error
- How to perform a search inside a specific taxonomy category
- Adding a query var to taxonomy term archive – gets redirected to the other taxonomy archive page
- add_query_arg to look up page title
- Can I use $query->set() (in a pre_get_posts() hook) with a custom taxonomy in WP 3?
- How can I query for all values of a custom taxonomies?
- query grandchildren taxonomy terms
- Is there a way to ‘Lock’ a Taxonomy?
- wp_insert_term is adding a term that has no name
- Get total number of comments from posts in a specific custom taxonomy
- Display one post from each term in a custom taxonomy [closed]
- WordPress json api taxonomy index method
- get_terms showing link to category even if all posts are drafts
- How to restrict on selecting child taxonomy
- Is it possible to sort the post based on a custom field?
- How do I get terms as a list for a specific post?
- Change in custom taxonomy permalink causes 404 error for another custom taxonomy
- Checking if a Page has an Associated Term?
- Displaying ACF image field [closed]
- How get custom field from custom taxonomy?
- Move terms from one taxonomy to another keeping the hierarchy
- Making certain categories of CPT not publicly queryable
- Custom Taxonomies not retaining hierarchy while importing from one site to another
- Output single post custom taxonomy child terms
- How to check if a post has at least 2 terms from a custom taxonomy attached?
- Custom Taxonomy template not display
- Terms Per Page in custom taxonomy Admin
- pre_get_posts post_meta event
- How can I add a custom permalink to a term?
- Custom taxonomy display name issue
- Variable Not Working Inside is_author() Array
- How do I hide a term from non-admin users in get_the_term_list?
- Disable a Custom Taxonomies default save mechanism
- Can I output a custom taxonomy as a submenu in the site navigation menu?
- Sort taxonomy page alphabetically by meta rather than default post date
- Random category URLs not working
- Product custom taxonomy is not found when space in name
- Display term picture of each post in a loop
- Get Terms of custom Taxonomy of products with certain Product Category
- Clean Taxonomy terms in new post type wordpress
- How to exclude the common terms?
- Custom dropdown list taxonomy not saved
- WordPress taxonomy terms archive template help
- How to get all the terms from a custom hierarchical taxonomy via REST api?
- Remove taxonomy name and add .html extension in the custom taxonomy term URL
- Pagination for Custom Taxonomy
- wp_insert_post and custom taxonomy
- Error 404 in Custom taxonomy with pagination
- Custom post type term names with ampersand in the term name
- WordPress Taxonomy Permalinks – Custom?
- Need help understanding a rewrite with multi-level taxonomy
- How to query authors by custom taxonomy?
- Display custom post term or taxonomy
- Attaching meta box to specific category/taxonomy in custom post type
- Change Permalink to Value of Custom Field
- Display custom post taxonomies
- Custom Taxonomy type in nav menu
- Advanced search: roles and multiple taxonomies
- Custom Fields link to other pages, not search
- Removing fields from category/taxonomy edit form
- Add Gutenberg editor to edit taxonomy (category) page
- post_type_link not working for posts without terms
- Why my archive title isn’t showing?