First of all, get all term slugs from the custom taxonomy space
by current post ID.
$space_terms = wp_get_post_terms( $post->ID, 'space' );
if( $space_terms ) {
$space_terms = array();
foreach( $space_terms as $term ) {
$space_terms[] = $term->slug;
}
}
You should specify the logical relationship between each inner taxonomy array when there is more than one.
The relation
key in the array describes the relationship. Possible values are OR
and AND
.
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'products-category',
'field' => 'slug',
'terms' => $course_terms,
),
array(
'taxonomy' => 'space',
'field' => 'slug',
'terms' => $space_terms,
),
),
Related Posts:
- Sort the main query in subcategories/terms?
- Filtering WP_Query Dynamically on the Front-End
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- display post count in archive page that have relation with another taxonomy term
- Display all Custom taxonomy terms and their relevant custom posts
- Get posts of an specific term of a custom taxonomy
- How to pass taxonomy terms to WP_Query along with $args?
- How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query
- Update post terms with custom taxonomy
- How do I display tags for a custom post type single page?
- Query/list all terms and their custom post count
- Custom Post Type Archive Page Filtering
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Get template part using a custom taxonomy term
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Genesis filterable portfolio isotope [closed]
- Get posts by querying taxonomy and certain terms of the taxonomy?
- How to restrict users and admin from creating new taxonomy terms?
- wp_query check if integer exists in custom field’s array
- Wrong request query on cpt and tax
- Get custom taxonomies from multiple posts
- Pagination for Custom Taxonomy Page [duplicate]
- Search / Filter posts on Title/Content OR Tags
- using $wpdb to get custom post type with term
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- Show posts from two or more custom taxonomy terms
- Allow user to set custom order to a list of custom taxonomies?
- Custom-Posttype & Custom Taxonomy WP_Query
- Custom loop with multiple taxonomy queries
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- Displaying custom taxonomy in the admin list of a custom post type
- Which post does a taxonomy term belongs to?
- Display post as term id
- Custom taxonomy rewrite give pagination 404
- How do I display the taxonomy term alongside the post type post title?
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Custom post taxonomies as tax_query terms?
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- Post count by month of taxonmy term
- Custom WP Query on custom meta and sort by multiple meta keys value
- How can I made custom taxonomies relationship?
- What’s the WP way to load remaining custom posts?
- Custom taxonomies relationship
- How do I display the taxonomy for a custom post type in an array
- Display Custom Taxonomy Alphabetically
- How to have this permalink structure: post_type/postname/custom_inner_page
- How do I require the specification of term in a custom post type and custom taxonomy?
- Custom Post, set object Taxonomy terms in plugin
- Query Custom Post Type Taxonomy term with multiple parameters
- Get terms that contain posts that in turn belong to other terms?
- First custom field value (out of several) displayed twice after query
- How to get custom posts sub category link
- Custom while loop for hierarchical display of a taxonomy
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Add Custom Post Type of specific Custom Taxonomy to regularly blog loop
- Display taxonomy terms, child terms and posts in a template
- Use custom walker to add taxonomy terms to main nav menu
- WP_Query orderby and tax_query
- Add term to custom post type on draft
- Displaying custom-taxonomy-terms sorted by parent/child-hierarchy?
- Listing all term items alphabetically / sorting loop
- Advanced search form with filters for custom taxonomies
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- Retrieve custom post types by custom taxonomies with WP_Query
- How to get WordPress term attached to the Post?
- Query posts with double taxonomy
- WP the_posts() on single-cars.php get category link
- tax_query not working in template
- Custom Taxonomy Not Showing in Front-End When Outputting a Custom Post Type with WP_Query()
- Print current post category during WP_Query
- Adding predefined terms to a taxonomy
- How to make WP_Query not to show irrelevant posts?
- Get parent category id from child category page for custom taxonomy
- WordPress wp_query() basic question about args
- Create an archive page for custom post type with custom taxonomy
- How to get only child terms from a custom taxonomy of current post type?
- Using page slug in wp_query
- WP_Query() with custom post type and taxonomy — get all terms?
- Custom query – get_the_terms not work
- Custom taxonomy wp_query woes.
- Variable not working in WP_Query
- WP_query – Filter by tax_query and meta_query using multiple select
- Creating two loops based on different logic
- Wp Query with multiple custom tag(taxonomy) by get the terms
- How to Display Posts From Category Within a Custom Taxonomy?
- Custom Post Types Archives and Single Pages not showing custom taxonomy data
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- WP_Query parameter conflict
- Shared terms between taxonomies
- how to get this tax_query working?
- Get terms of a post but only if they’re also the child of a specific term
- Different options per post type in WP_Query
- The Difference Between Categories and Tags and Taxonomies and Terms
- How to get dropdown instance value in WordPress custom Widget
- How to sort a WP_Query by a custom field AND ALSO filter by a different custom field
- Get taxonomy term by slug in post on archive page
- How to show all taxonomies within custom post type loop
- How to get the post terms from a child taxonomy