diff --git a/changelog.txt b/changelog.txt
index 8c1de4e..092bf07 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -8,6 +8,7 @@
* Dev - Imroving search styles.
* Dev - Adding filter number to search results on mobile.
* Fix - Restricted the post type labels to the global search only.
+* Dev - Updating the FacetWP Queries
### 1.2.0 - 21 June 2019
* Dev - Adding rel="noopener noreferrer" tags to target="_blank" links
diff --git a/classes/class-lsx-to-search-frontend.php b/classes/class-lsx-to-search-frontend.php
index e65424f..b165bf0 100644
--- a/classes/class-lsx-to-search-frontend.php
+++ b/classes/class-lsx-to-search-frontend.php
@@ -770,7 +770,7 @@ public function search_form( $atts = array() ) {
helper->get_facet_by_name( $facet );
- $values = $this->get_form_facet( $facet['source'] );
+ $values = $this->get_form_facet( $facet['name'] );
$this->display_form_field( 'select',$facet,$values,$combo_box );
?>
@@ -873,7 +873,7 @@ protected function get_form_facet( $facet_source = false ) {
$values = array();
$select = 'f.facet_value, f.facet_display_value';
$from = "{$wpdb->prefix}facetwp_index f";
- $where = "f.facet_source = '{$facet_source}'";
+ $where = "f.facet_name = '{$facet_source}'";
//Check if the current facet is showing destinations.
if ( stripos( $facet_source, 'destination_to' ) ) {
@@ -881,9 +881,7 @@ protected function get_form_facet( $facet_source = false ) {
$where .= " AND p.post_parent = '0'";
}
-
$response = $wpdb->get_results( "SELECT {$select} FROM {$from} WHERE {$where}" ); // WPCS: unprepared SQL OK.
-
if ( ! empty( $response ) ) {
foreach ( $response as $re ) {
$values[ $re->facet_value ] = $re->facet_display_value;