alleyinteractive / searchpress

Elasticsearch integration for WordPress.
84 stars 12 forks source link

Selected Flag Doesn't Work Properly with More Than One Selected Term #150

Closed kevinfodness closed 2 years ago

kevinfodness commented 2 years ago

get_facet_data relies on get_query_var, which in turn relies on $wp_query->tax_query->queried_terms, which for backward compatibility reasons only stores the first queried term for each taxonomy. This means that the selected flag for facet terms will only ever be accurate for the first selected term within a taxonomy.

In order to fix this, we need to build a list of queried terms per taxonomy ourselves directly from $wp_query->tax_query->queries and use that instead of get_query_var.