Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/facets tax query #2560

Merged
merged 12 commits into from
Feb 22, 2022
Prev Previous commit
Next Next commit
Revert "Change function name"
This reverts commit 7df736d.
  • Loading branch information
oscarssanchez committed Feb 15, 2022
commit 0c5848a7ccdc1b6fc3a922be96b1194c10ea34b2
6 changes: 3 additions & 3 deletions includes/classes/Feature/Facets/Facets.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public function facet_query( $query ) {

foreach ( $selected_filters['taxonomies'] as $taxonomy => $filter ) {
$tax = isset( $attribute_taxonomies[ $taxonomy ] ) ? $attribute_taxonomies[ $taxonomy ] : $taxonomy;
if ( ! $this->has_pre_existing_taxonomy_query( $tax_query, $tax ) ) {
if ( ! $this->has_taxonomy_query( $tax_query, $tax ) ) {
$tax_query[] = [
'taxonomy' => $tax,
'field' => 'slug',
Expand All @@ -343,13 +343,13 @@ public function facet_query( $query ) {
}

/**
* Determine if we already have a taxonomy query before attempting to add a new one for each filter.
* Determine if we have a taxonomy query before attempting to add a new one for each filter.
*
* @param $tax_query array The current tax_query.
* @param $taxonomy string WP Taxonomy.
* @return bool true or false.
*/
function has_pre_existing_taxonomy_query( $tax_query, $taxonomy ) {
function has_taxonomy_query( $tax_query, $taxonomy ) {
foreach ( $tax_query as $query ) {
if ( is_array( $query ) && $taxonomy === $query['taxonomy'] ) {
return true;
Expand Down