You’ll want to have a look at get_the_terms().
<?php
// You need to define the post id from the post you are outputting in the right bar so that the left bar knows how to match up the terms
$country = get_the_terms( $post->id, 'countries' )
$args = array(
'post_type' => 'side_menu',
'posts_per_page'=> 1,
'tax_query' => array(
// 'relation' => 'AND', /* I don't think you need this unless it has another purpose */
array(
'taxonomy' => 'countries',
// This only works since you are selecting just one term per post
// Works by retrieving the first and only term id from the post in the right bar
'terms' => array_shift(array_keys($country))
)
)
);
$the_menu = new WP_Query( $args );
if ( have_posts() ) : while ( $the_menu->have_posts() ) : $the_menu->the_post(); ?>
?>
Related Posts:
- How to get parent and child sub category (Taxonomy) order to display
- Is There a Difference Between Taxonomies and Categories?
- Check if a post is in any child category of a parent category
- How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms
- How to display non-hierarchical taxonomy as terms with checkboxes?
- get_categories for custom post type with a specific custom taxonomy attached
- Control term order on a per-post basis
- Could not insert term into the database
- How can I add the featured image functionality to a custom taxonomy?
- Share one taxonomy across multiple blogs in 3.0 [duplicate]
- Can a Child Category Have More than One Parent?
- is_category() in pre_get_posts strange error
- Combine two taxonomies in a hierarchical tree
- Weird behaviour when adding terms/term_taxonomies programmatically
- Category post count is not correct
- Disable Category Taxonomy
- WordPress Default Category and Custom Taxonomy Selected Attribute not Working After Searched in wp_dropdown_categories Array
- Automatically adding tags and categories into Post Excerpt for searching
- How can i add service category here? [duplicate]
- List of post categories only associated to another custom taxonomy
- Show subChild categories
- How can i change sort category view starting from child then parent, not alphabetically
- WordPress 5.4 and higher: Filter posts by category 1 AND category 2 in API requests
- How to set the same base url for two different taxonomies?
- how tho change number of posts in loop from specific categories
- Limit categories to hierarchal depth of 2
- How to set acf color field as background color to product category
- How to target all woocommerce categories that don’t have any subcategories in them?
- Show the parent taxonomy by creating shortcode in woocommerce?
- Filtering posts in category by tag URL
- WordPress Portofolio Conditional Templating – functions php
- Parent Category and Subcategory default text generated with category
- Get WooCommerce product category list in functions.php
- Post List by category and under custom taxonomy
- Bulk assign posts to a category using SQL (MySQL)
- get taxonomy list in a page in the wordpress
- Number of categories slowing down the site
- Image Upload Custom Form Field for Category and Custom Taxonomy
- outputting taxonomy hierarchy
- Get category from slug list
- Confused about category.php template – not working
- Filter custom taxonomy posts via AJAX
- No results found for second level category
- Create duplicate category page with content variations
- Why use hierarchical taxonomies instead of many custom taxonomies?
- Renaming default category taxonomy?
- How get all media from a posts category by db?
- Issue with WordPress category search
- How to echo Tags and Categories as plain text
- Querying posts from two different categories while looping inside another loop
- How can I get all the posts that are related with a specific taxonomy term?
- How can I add HTML classes for current taxonomy/term hierarchy into my pages to simplify styles?
- How to Manage and link certain custom taxonomy?
- how to get postmeta info based on multiple categories?
- Too many categories drastically slow down my website
- How to get posts from many categories using WP_Query
- Display List of Categories Within a Custom Taxonomy
- Display Taxonomies in loop with template args
- Is it possible to query the result of a query?
- How to add a post with new Taxonomy without assigning to default category?
- show posts found in multiple categories via category_name query string?
- Grouping parent categories into sections
- Display related posts with same category or same tag return blank
- get_adjacent_post_link excluded_terms ignored
- Taxonomy for custom post type not found
- Category base 404 – fix
- Category slug in in loop always the same?
- Why is my post categories not displaying?
- Display only the latest post
- display certain category on custom template page
- Detecting top parent category fails on home page
- How to use Greek characters/letters in a query?
- Problem importing categories and sub-categories
- Displaying posts by year
- wordpress category.php query for featured news item, broken pagination and repeating posts
- Return selected categories only in custom page meta box?
- Assign a category by user and customize the edit-tags.php?taxonomy=category page
- list taxonomy based on taxonomy
- get IDs from links categories
- Multiple Parent Category URLs
- Chained drop-down menu for custom taxonomy using chained.js
- Show parent-child relationship for categories in the wordpress admin
- Display only one level subcategory in wordpress
- Converting Categories (with ACF fields) to custom taxonomies
- Woocommerce custom taxonomy order
- Hook action when create new category [duplicate]
- Taxonomy term RestApi data 10 rows limitions
- How to show posts of a specific category
- Order Categories by Character Count
- Images as Categories
- hide_empty property not working when using get_terms
- Add custom fields to Woocommerce Category Page
- Quick Edit on taxonomy names results in error
- How to make /category/ URL load properly instead of 404 error?
- How can I get the categories and subcategories separately?
- How to query by subcategory and, if there are fewer than 10 posts in that subcategory, fill out with posts from parent category
- How to make query loop block dynamic
- When using get_terms with hide_empty = true, terms that only contain scheduled posts are not returned. How to override this?
- Two related taxonomies. how to filter terms in second taxonomy depending on selected term in first taxonomy on Post edit page?
- get_term returns different results, sometimes empty, sometime the correct list