Skip to content

Commit

Permalink
Merge pull request #437 from kprajapatii/master
Browse files Browse the repository at this point in the history
Search by tag keyword not working properly - FIXED
  • Loading branch information
Stiofan authored Aug 25, 2017
2 parents 048c843 + 17a83d8 commit 03e38be
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ v1.6.23
"All" string is not translated in popular post widget title - FIXED
Fix post name for autosaved listing from backend - FIXED
Added filter to the geodir_listing_belong_to_current_user() function - ADDED
Search by tag keyword not working properly - FIXED

v1.6.22
Comment replies should not add review structured data - FIXED
Expand Down
23 changes: 13 additions & 10 deletions geodirectory-functions/listing_filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -801,13 +801,13 @@ function searching_filter_where($where) {


// get term sql
$term_sql = " SELECT $wpdb->term_taxonomy.term_id
FROM $wpdb->term_taxonomy, $wpdb->terms, $wpdb->term_relationships
WHERE $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id
AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id
AND $wpdb->term_taxonomy.taxonomy in ( {$taxonomies} )
$terms_where
GROUP BY $wpdb->term_taxonomy.term_id";
$term_sql = "SELECT $wpdb->term_taxonomy.term_id, $wpdb->terms.name, $wpdb->term_taxonomy.taxonomy
FROM $wpdb->term_taxonomy, $wpdb->terms, $wpdb->term_relationships
WHERE $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id
AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id
AND $wpdb->term_taxonomy.taxonomy in ( {$taxonomies} )
$terms_where
GROUP BY $wpdb->term_taxonomy.term_id";

$term_results = $wpdb->get_results($term_sql);
$term_ids = array();
Expand All @@ -817,10 +817,13 @@ function searching_filter_where($where) {
foreach($term_results as $term_id){
$term_ids[] = $term_id;
}
if(!empty( $term_ids)){

if (!empty($term_ids)) {
foreach($term_ids as $term){
$terms_sql .= " OR FIND_IN_SET($term->term_id , ".$table.".".$post_types."category) ";
if ($term->taxonomy == $post_types.'_tags') {
$terms_sql .= $wpdb->prepare(" OR FIND_IN_SET(%s , " . $table . ".post_tags) ", $term->name);
} else {
$terms_sql .= " OR FIND_IN_SET($term->term_id , " . $table . "." . $post_types . "category) ";
}
}
}
}
Expand Down

0 comments on commit 03e38be

Please sign in to comment.