From 4e7c773150cc446e79d3737964934f8f7b0906a0 Mon Sep 17 00:00:00 2001 From: Itai Lulu Koren Date: Sun, 22 Feb 2015 17:59:01 +0200 Subject: [PATCH] Fix defaults for multiple filters Re-initialization of $taxs[] is needed, else only the first filter is assigned as "selected" when using multiple filters. Exaplanation: Each taxonomy array should contain only one term-id. See a dump before the fix (note the duplicated elements): https://db.tt/kMKY9IqR and after the fix: https://db.tt/X4MnpZTX --- search-filter.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/search-filter.php b/search-filter.php index 721d26e..6e83eeb 100644 --- a/search-filter.php +++ b/search-filter.php @@ -547,7 +547,7 @@ public function set_defaults() //grab search term for prefilling search input if(isset($wp_query->query['s'])) - {//!"£$%^&*() + {//!"£$%^&*() $this->searchterm = trim(get_search_query()); } @@ -572,7 +572,6 @@ public function set_defaults() $this->defaults[SF_FPRE.'post_tag'] = $tags; - $taxs = array(); //loop through all the query vars foreach($wp_query->query as $key=>$val) { @@ -582,6 +581,8 @@ public function set_defaults() //now check it is a desired key if(in_array($key, $this->taxonomylist)) { + $taxs = array(); + $taxslug = ($val); //$tax_params = explode("+",esc_attr($taxslug)); @@ -1721,4 +1722,4 @@ function walk_taxonomy( $type = "checkbox", $args = array() ) { require_once(SEARCHANDFILTER_PLUGIN_DIR."/of-admin.php"); -?> \ No newline at end of file +?>