WordPress.org

Support

Support » How-To and Troubleshooting » What should the term value in a tax_query for not filtering by that term?

What should the term value in a tax_query for not filtering by that term?

  • I have a couple of dropdown’s that I’m using to filter the results for a custom query.
    This is part of the code I use for filter the results.

    // tax query
    'tax_query' => array(
    	'relation' => 'AND',
    	array(
    		'taxonomy' => 'zonas',
    		'field' => 'slug',
    		'terms' => $zona,
    		'operator' => 'IN'
    		)
    	)

    If an item of the dropDown “zona” was selected, that’s the value I use for the $zona variable.
    What should be the value of $zona, if I don’t want to filter by that term? (when nothing is selected from the “zona” dropdown)
    I tried with “NULL”, but that doesn’t work.
    Thanks

Viewing 1 replies (of 1 total)
  • Could somebody please help me?
    I think this should be very simple, buy I spent lots of hours trying to make this work

Viewing 1 replies (of 1 total)
  • The topic ‘What should the term value in a tax_query for not filtering by that term?’ is closed to new replies.
Skip to toolbar