Populate tax_query terms parameter with post term

You have a couple of issues here. As your code stand, $post is undefined. It is actually better to make use of get_the_ID() to get the post ID instead of $post wp_get_post_terms() makes an extra db call, so if you are really set on performance, I would rather use get_the_terms() You are returning term names, … Read more

Querying on multiple taxonomies pulled from $_GET checkbox array not working?

Here: $search_values[‘tax_query’] = array ( You’re resetting the value of tax_query for every item in the foreach loop. It’s also being set to an invalid value: Important Note: tax_query takes an array of tax query arguments arrays (it takes an array of arrays). This construct allows you to query multiple taxonomies by using the relation … Read more

Get taxonomy parent using child slug (from merged taxonomies)

Since in most cases I would need to now the ‘taxonomy’, one work around I found (actually, pointe by @Howdy_McGee) was to pass the slug of the term and it’s parent to the value, and then split-string. Here is my final code: foreach ($tax_categorias as $tax_categoria) { echo ‘<option value=”. $tax_categoria->slug .”.’. $tax_categoria->taxonomy .” . … Read more

How can I add multiple ‘tax_query’ arrays via a loop?

OK, I have no idea how and why your code should work… It has nothing in common with correct PHP syntax… But it’s pretty good pseudo-code, so I think I can guess, what you wanted to achieve… $tax_query = array(); if ( have_rows(‘category_taxonomies’) ) { while ( have_rows(‘category_taxonomies’) ) { the_row(); $tax_query[] = array( ‘taxonomy’ … Read more

Nested tax_query that allows specified categories OR tags, but NOT other categories

I think I figured it out. This query appears to work: $args = array(); if ( isset( $term_ids ) && isset( $category_ids ) ) { $args[‘tax_query’] = array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘term_id’, ‘terms’ => $omit_category_ids, ‘operator’ => ‘NOT IN’, ), array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘category’, ‘field’ … Read more

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