Parses the term_id as an integer in Elastic_Press::format_aggregations_facet method

This commit is contained in:
Rafael Chaves Freitas 2020-05-08 15:35:44 -03:00
parent 9aa0ebc4aa
commit 82f365d820
1 changed files with 3 additions and 3 deletions

View File

@ -727,13 +727,13 @@ class Elastic_Press {
$buckets = ($has_include == false ? $aggregation['buckets'] : $aggregation[$key]['buckets']);
foreach ($buckets as $term) {
if ($has_include) {
$term_id = $term['key'];
$term_id = intval($term['key']);
$doc_count = $term['doc_count'];
} else {
$term_id = $term['key'][$key];
$term_id = intval($term['key'][$key]);
$doc_count = $term['doc_count'];
}
if ($term_id == '') continue;
if ($term_id === 0) continue;
$term_object = \Tainacan\Repositories\Terms::get_instance()->fetch($term_id, $taxonomy_slug);
$count_query = $wpdb->prepare("SELECT COUNT(term_id) FROM $wpdb->term_taxonomy WHERE parent = %d", $term_id);