Skip to content

Commit

Permalink
Fix to add array values individually in query filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
gyrus committed Apr 29, 2015
1 parent 305a30d commit 8a75c95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion readme.txt
Expand Up @@ -94,7 +94,7 @@ Please raise any issues via [GitHub](https://github.com/gyrus/WordPress-Develope
= 1.2 =
* Changed Google maps integration to allow multiple markers (thanks adriantoll!) - please read [the release notes](http://sltaylor.co.uk/blog/developers-custom-fields-1-1/)
* Changed query filtering for Simple Events date fields to use WP 4.1+ syntax to better handle start and end dates
* Fix to use 'IN' comparison for array values in query filtering
* Fix to add array values individually in query filtering

= 1.1.1 =
* Fixed issue with max-width: 100% messing up Google controls
Expand Down
13 changes: 12 additions & 1 deletion slt-cf-query-vars.php
Expand Up @@ -132,13 +132,24 @@ function slt_cf_manage_query_string( $query ) {
}


} else if ( is_array( $value ) ) {

// Add each item in array separately
foreach ( $value as $value_item ) {
$new_clauses[] = array(
'key' => slt_cf_field_key( $key ),
'value' => $value_item,
'compare' => '=',
);
}

} else {

// Simple pass-through
$new_clauses[] = array(
'key' => slt_cf_field_key( $key ),
'value' => $value,
'compare' => is_array( $value ) ? 'IN' : '=',
'compare' => '=',
);

}
Expand Down

0 comments on commit 8a75c95

Please sign in to comment.