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
- Get terms by taxonomy AND post_type
- Exclude a category from WP_Query
- Get terms that contain posts that in turn belong to other terms?
- The Operator “NOT IN” Does Not Work In tax_query
- wp_insert_term doesn’t work with custom post type’s taxonomy
- Custom Post Type Archive Template
- 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?
- Help with hierarchical custom taxonomies and permalinks…almost there
- Custom Taxonomy and tax_query Issue?
- Get list of terms of current taxonomy archive for another taxonomy
- Dynamically create/remove terms in taxonomy when custom post type is published/trashed
- Optimised Code for Pulling Taxonomy Posts
- Show Post Count of a Category
- How to filter the taxonomy terms based on another taxonomy term
- Fetch taxonomies by custom post type id array
- get_the_terms return only last term
- Does WordPress limit the length of slug names for Post Meta or Terms?
- shortcode to show custom post types by category
- Query/list all terms and their custom post count
- Genesis filterable portfolio isotope [closed]
- Get custom taxonomies from multiple posts
- Pagination for Custom Taxonomy Page [duplicate]
- Custom loop with multiple taxonomy queries
- Display post as term id
- Custom taxonomy rewrite give pagination 404
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Display Custom Taxonomy Alphabetically
- How to have this permalink structure: post_type/postname/custom_inner_page
- Get terms that contain posts that in turn belong to other terms?
- 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
- 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
- WP_Query() with custom post type and taxonomy — get all terms?
- Variable not working in WP_Query
- Wp Query with multiple custom tag(taxonomy) by get the terms
- WP_Query parameter conflict
- Shared terms between taxonomies
- How to get dropdown instance value in WordPress custom Widget
- Get taxonomy term by slug in post on archive page
- custom hierarchical taxonomy and custom post type list contains surplus posts
- Urls in Custom Post Type work for Terms but not for its Taxonomies
- List all Custom Post Type posts excluding certain Taxnomy term
- Add filter to Admin list for all custom post types by their custom taxonomies
- Add the custom post term to the custom post title
- Retrieve Custom Taxonomies with Description and Slug
- How to list posts by term (custom taxonomy)
- Query custom posts from custom taxonomy
- Taxonomy terms with the same name are updated between separate custom post types
- Related “custom post type” using “custom taxonomy”
- Add a class to a div if custom post type has specific terms?
- custom post type and a “sticky” position taxonomy
- Display post count for a specific month
- Custom taxonomy terms hierarchical navigation
- How to list posts by terms
- How to order taxonomy terms by most recent post?
- WP_Query to display number of custom post type filtered (order by) taxonomy
- Live search by custom tag
- WP_Query based on ‘s’ and tax_queries
- Ajax load more inside custom post type taxonomy
- WP Query tax_query not returning posts
- How to show terms used only for particular custom post type. Filter creation perpose
- Create a custom wp_query from a specific custom post type with specific taxonomy
- The most recent post of custom taxonomy
- order taxonomy alphabetical
- Problems with the WP_Query query for a Custom post type
- Filter Term By Parent Term – Custom Post Type
- WordPress get all post with like in terms [duplicate]
- Decrement term in for each
- CPT Efficient way to display posts from different categories with custom query
- Best way to group posts based on custom post type terms
- Get archive of posts separated by taxonomies and subtaxonomies
- Query Pulling the same post twice
- Post data in separate divs with incrementing class using WP_Query
- How to retrieve the permalink for a specific (custom) term?
- Values inside a custom field to determine which category posts to display
- Get term_id for each instance of custom taxonomy
- List a custom taxonomy’s terms, with links, on the taxonomy page
- WP Query WordPress Post Type with the same Taxonomy name
- How to list groupings and keep pagination
- install.php Custom Taxonomy Term not being added to custom post
- How to retrieve taxonomy terms of the current custom post?
- Listing all custom post types using a specific term on the said term’s template page, in groups
- show 10 most recent custom post types excluding the one(s) from specific custom taxonomy
- display custom post type from register taxonomy
- Get term link of shared taxonomy between multiple post types
- WP Query – Can’t get posts with specific taxonomy