Tax query with multiple terms in pre_get_posts

Just use: ‘terms’ => $rt_cat_id I’ll work for both array and single-based values. Or you can simplify your code as follows: if( isset( $_GET[ ‘listing_cat’ ] ) ) { $tax_query[] = array( ‘taxonomy’ => ‘listing_category’, ‘field’ => ‘id’, ‘terms’ => $_GET[ ‘listing_cat’ ] ); }

Tax Query only returns for the first of several terms

Related issue: Multiple relationship for multiple tax_query in WP_Query The issue here was that mixed multi-relationship lookups are only permitted using the term_taxonomy_ids field in the query, the above worked fine once switched like so: $params = [ “status” => “publish”, “tax_query” => [ [ “taxonomy” => “jewellery_metal”, “field” => “term_taxonomy_id”, “terms” => [ 36, … Read more

WP_Query parameter conflict

Is your post type non-hierarchical like a post – or hierarchical like a page? It will determine which slug parameter you should be using in WP_Query: name (string) – non-hierarchical (post) slug. pagename (string) – hierarchical (page) slug. Also, the tax_query should have the operator parameter. Possible values are ‘IN’, ‘NOT IN’, ‘AND’. You should … Read more

WP_query – Filter by tax_query and meta_query using multiple select

My initial code did not provide default WP_query argument parameters if either Select option was not set – the empty Parameter would filter everything out. To the best of my ability, I applied default parameter values from the initial Post and Terms queries and now the select filter is working. I would be pleased to … Read more

Order or Orderby in tax_query (How to define order of terms in WP_Query)

From the get_terms documentation: orderby (string): Field(s) to order terms by. Accepts term fields (‘name’, ‘slug’, ‘term_group’, ‘term_id’, ‘id’, ‘description’), ‘count’ for term taxonomy count, ‘include’ to match the ‘order’ of the $include param, ‘meta_value’, ‘meta_value_num’, the value of $meta_key, the array keys of $meta_query, or ‘none’ to omit the ORDER BY clause. Defaults to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)