What should the term value in a tax_query for not filtering by that term? (2 posts)

  1. gprego
    Posted 3 years ago #

    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',
    		'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.

  2. gprego
    Posted 3 years ago #

    Could somebody please help me?
    I think this should be very simple, buy I spent lots of hours trying to make this work

Topic Closed

This topic has been closed to new replies.

About this Topic