2

As jdm2112 and SallyCJ said in the comments, the query lacks of 'field' => 'slug'. So: 'tax_query' => [ 'relation' => 'AND', [ 'taxonomy' => 'link-category', 'terms' => $link, 'field' => 'slug' ], [ 'taxonomy' => 'despacho', 'terms' => $despacho, 'field' ...


2

Tax query is formed wrong. It also array of arrays(queries) get_posts([ 'meta_query' => [ [ 'key' => 'country', 'value' => 'Japan', 'compare' => 'LIKE' ] ], 'tax_query' => [ [ 'taxonomy' => 'category', 'field' => 'slug', 'terms' ...


1

Looking at the WP_Query documentation on tax_queries ew can see it accepts a nested array as a parameter. Compare that to the provided code: 'tax_query' => array( 'taxonomy' => 'news_category', 'field' => 'term_id', 'terms' => 82, ), Should look like: 'tax_query' => [ [ 'taxonomy' => 'news_category', 'field' ...


1

So, I need to run a Tax query inside a Meta query clause. This does not seem to be possible with the 'meta_query' argument, something like this: Correct, what you want to do is not possible using the parameters of WP_Query while keeping your data stored as is. The query is already very expensive/slow to run, and if you could add in the taxonomy term query ...


1

You can setup a tax_query with the NOT IN comparison operator. WP_Query( array( 'post_type' => 'product', 'posts_per_page' => 500, 'tax_query' => array( 'relation' => 'AND' array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( 'cars' ), ),...


1

The whole problem was in WooCommerceCategoryExcluder (old, obsolete and unmaintained) plugin which hooks to pre_get_posts and adds taxonomy query to get_posts() args. Maybe this investigation helps someone else trying to solve similar problem.


1

If you haven't done so already, I would recommend you to turn on debug logging in wp-config.php as it makes it easier to trace the error in your code. // added to wp-config.php define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); // find error.log in /wp-content, shows backtrace for errors define( 'WP_DEBUG_DISPLAY', false ); // true if you want ...


1

Just use another set() method: if ($value['pRange'] && $value['tags']) { $wp_query->set('tax_query', array( 'relation' => 'OR', array( 'taxonomy' => 'product_tag', 'field' => 'slug', 'terms' => $value['tags'], ), array( '...


1

This would work. As posted by @bucketpress. $someposts = get_posts( array( 'post_type' => 'work', 'posts_per_page' => -1, 'fields' => 'ids', // return an array of ids ) ); $somepoststerms = get_terms( array( 'taxonomy' => 'category', 'object_ids' => $someposts, 'hide_empty' => ...


1

I can see you are trying to be clear but still a really confusingly worded question, broke my brain a bit. I think this might achieve what you want, but I'm not fully sure if I understand you correctly or not. Try it out anyway, it may or may not work: $downloads_parent_posts = get_posts( array( 'post_type' => 'downloads', 'orderby' ...


Only top voted, non community-wiki answers of a minimum length are eligible