From 94529922fe79c03ca0b5b718f192888ef353dded Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Tue, 22 Oct 2019 14:29:53 -0300 Subject: [PATCH] use `hide_empty` from the API parameters #318 --- src/api/class-tainacan-rest-controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/class-tainacan-rest-controller.php b/src/api/class-tainacan-rest-controller.php index cc5222e29..9ad8fe024 100644 --- a/src/api/class-tainacan-rest-controller.php +++ b/src/api/class-tainacan-rest-controller.php @@ -165,7 +165,7 @@ class REST_Controller extends \WP_REST_Controller { $terms = get_terms([ 'taxonomy' => $tax_query['taxonomy'], 'fields' => 'ids', - 'hide_empty' => false, + 'hide_empty' => isset($args['hide_empty']) ? $args['hide_empty'] : true, 'search' => $tax_query['terms'] ]); @@ -180,7 +180,7 @@ class REST_Controller extends \WP_REST_Controller { $terms = get_terms([ 'taxonomy' => $tax_query['taxonomy'], 'fields' => 'ids', - 'hide_empty' => false, + 'hide_empty' => isset($args['hide_empty']) ? $args['hide_empty'] : true, 'search' => $tax_query['terms'] ]); if ($terms) {