WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. gprego
    Member
    Posted 1 year 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',
    	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

  2. gprego
    Member
    Posted 1 year 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