I managed to do it. I used the following query parameter:
'tax_query' => array(
array('taxonomy' => 'wpccategories',
'field' => 'slug',
'terms' => $termz
)
)
With $termz
being: $termz = wp_get_object_terms($id, 'wpccategories', array("fields" => "slugs"));
The problem I struggled with was that I needed to use singular 'field'
with singular 'slug'
in the tax_query
(I knew this) but I needed to use plurar in the wp_get_object_terms
function. So the other way around of any other kind doesn’t seem to work.
Related Posts:
- Show posts without term
- Custom taxonomy.php not working
- Check if a post has term inside loop
- display ACF repater field in archive page
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- Display posts the match taxonomy term linked from wp_list_categoies?
- Custom archive page based on array of categories and tags
- List taxonomy terms plus their latest post ordered by post date
- WP_Query use for a filter with multiple Taxonomies and Terms
- tax_query shows no results if nothing is selected
- Get array of current post term ID’s
- Query Custom Post Type Order By Taxonomy Field
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Function get_queried_object() return NULL in custom taxonomy
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- List custom taxonomy terms sharing posts with a term from a second custom taxonomy
- How to Filter Posts by Custom Fields?
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How to order posts by title after they have already been sorted by category
- Search form not working with custom query?
- Post loop for all taxonomy terms
- Filter Custom Taxonomy Posts
- get all posts associated with a custom taxonomy
- How to add custom meta to ‘pre_get_terms’?
- get term id from term name
- WP_Query to output chosen term and posts with no term assigned
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- How to print term name inside wp post loop
- Query Taxonomy By Page Title
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- How do I stop the same post showing multiple times in a archive?
- Get categories within specific term
- list all post who have mutual taxonomy as current taxonomy!
- Taxonomy archive, categorised by other taxonomy, not hiding empty taxonomies
- How to define a custom hierarchy for terms?
- Taxonomy Terms That Don’t Exist Display Results
- Output ACF field dynamicaly within a taxonomy loop [closed]
- tax_query not working properly with get_posts
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- WP_Query on custom taxonomy -> Location and Activity
- Include custom post type that matches taxonomy field in another custom post type
- Need help with Query Loop. Need to get current taxonomy term and its posts and group them by a different selected taxonomy term
- How do I exclude a custom taxonomy from the post loop
- Can I force WP_Query to return no results?
- Resetting post data to previous loop in nested loops
- Display all posts in a custom post type, grouped by a custom taxonomy
- Some doubts about how the main query and the custom query works in this custom theme?
- Get post count of current loop when using multiple queries on one page
- Multiple WP_Query loops with Pagination
- Using a custom WP_Query with get_template_part loop
- WordPress tax_query “and” operator not functioning as desired
- Custom taxonomy query broken after upgrade to 4.4
- WP_Query vs get_posts
- Loop within a loop?
- WP_Query and next_posts_link
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- Custom Taxonomy and Tax_Query
- Display products from specific category in shop page
- How to list some posts first in the loop based on post id
- How to add taxonomy filter on the query fly?
- Pagination returns 404 after page 20
- Make loop display posts by alphabetical order
- WP_Query: query posts by ids from array?
- Use WP_Query with have_posts()?
- get custom post type by tag
- How to get order of posts?
- display posts with same taxonomy term
- Order posts by ID in the given order
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- get_template_part in for loop
- query multiple taxonomies
- Including all terms in wordpress tax_query
- Get array of posts from the current archive page loop
- pre_get_posts with get_posts
- How-to exclude terms from the main query the most performant way?
- Pagination with WP_Query is buggy – working for some pages, but not the others
- Get the number of posts from the current page results
- Executing Queries in tag.php
- How can I save an array from a random post sequence for later use?
- How to place a loop within another loop?
- WordPress Custom Query to show posts from last x years
- How to order posts tag by tag?
- Query two taxonomies via URL or link?
- Query Custom Meta Value with Increment
- Display one post from each term in a custom taxonomy [closed]
- “pre_get_posts” firing on every query
- Why is my WP_Query not working when tax_query terms are an array?
- Show two random posts from custom post type
- Add the “active” class only to the first loop item in a WordPress query [closed]
- Get list of posts which have at least one term from a custom taxonomy with WP_Query
- Loop through all tags & output posts in alphabetical list
- Pagination with 5 posts per page
- Identify which loop you are hooking into; primary or secondary?
- In loop: posts have thumbnail AND other variables
- WP_query taxonomy + get all posts with two terms from same taxonomy
- Counting number of posts with Category B in Category A
- Group posts by custom field
- How to order category.php loop by ‘meta_value’?