tax_query: What to pass when I want to have all terms?

Simply omit (or not add) tax_query part of arguments. $args = array( ‘post_type’ => ‘wr_event’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘event_date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => $order, ‘meta_value’ => $yesterday, ‘meta_compare’ => $compare, ); if ( ! is_null($cat) ) $args[‘tax_query’] =array( array( ‘taxonomy’ => ‘event_type’, ‘field’ => ‘slug’, ‘terms’ => $cat, ‘operator’ => ‘IN’ ), … Read more

How to Get All Taxonomies AND All Terms For Each Taxonomy With Post Count Zero

You can do this with just get_terms – this allows you to fetch all (or some) of the terms from one (or more) taxonomies. By default it excludes ’empty’ terms, so you’ll need to set the arguments appropriately. //Array of taxonomies to get terms for $taxonomies = array(‘category’,’post_tags’,’my-tax’); //Set arguments – don’t ‘hide’ empty terms. … Read more

Multiple, nested tax_query relation

The cat-parameter is not overwritten by tax_query. Instead, it is added to tax_query. Thus, using ‘cat’ => -5, the following array is appended to tax_query: ( [taxonomy] => category [terms] => Array ( [0] => 5 ) [include_children] => 1 [field] => term_id [operator] => NOT IN ) The resulting taxonomy query is built up … Read more

Get term by custom term meta and taxonomy

Try This: $args = array( ‘hide_empty’ => false, // also retrieve terms which are not used yet ‘meta_query’ => array( array( ‘key’ => ‘feature-group’, ‘value’ => ‘kitchen’, ‘compare’ => ‘LIKE’ ) ), ‘taxonomy’ => ‘category’, ); $terms = get_terms( $args );

WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)

Nevermind I (think) I got it… $args = array( ‘post_type’ => ‘product’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘slug’, ‘terms’ => array( ‘ring’ ), ), array( ‘taxonomy’ => ‘product_tag’, ‘field’ => ‘slug’, ‘terms’ => array( ‘black’, ‘men’ ), ‘operator’ => ‘AND’ ), ), ); Missing the ‘operator’ => ‘AND’ … Read more

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