use `hide_empty` from the API parameters #318

This commit is contained in:
vnmedeiros 2019-10-22 14:29:53 -03:00
parent 0ce1bc3e8e
commit 94529922fe
1 changed files with 2 additions and 2 deletions

View File

@ -165,7 +165,7 @@ class REST_Controller extends \WP_REST_Controller {
$terms = get_terms([ $terms = get_terms([
'taxonomy' => $tax_query['taxonomy'], 'taxonomy' => $tax_query['taxonomy'],
'fields' => 'ids', 'fields' => 'ids',
'hide_empty' => false, 'hide_empty' => isset($args['hide_empty']) ? $args['hide_empty'] : true,
'search' => $tax_query['terms'] 'search' => $tax_query['terms']
]); ]);
@ -180,7 +180,7 @@ class REST_Controller extends \WP_REST_Controller {
$terms = get_terms([ $terms = get_terms([
'taxonomy' => $tax_query['taxonomy'], 'taxonomy' => $tax_query['taxonomy'],
'fields' => 'ids', 'fields' => 'ids',
'hide_empty' => false, 'hide_empty' => isset($args['hide_empty']) ? $args['hide_empty'] : true,
'search' => $tax_query['terms'] 'search' => $tax_query['terms']
]); ]);
if ($terms) { if ($terms) {