Lists all taxonomy metadata in tags list, even if from the same taxonomy from different collections. #778.

This commit is contained in:
mateuswetah 2023-03-31 12:09:32 -03:00
parent 95c8d57250
commit 76578affa9
1 changed files with 25 additions and 18 deletions

View File

@ -434,29 +434,36 @@ class REST_Items_Controller extends REST_Controller {
return $t != false ? $t->name : '--';
}, $terms_id);
$metas = $this->metadatum_repository->fetch(array(
'meta_query' => [
[
'key' => 'collection_id',
'value' => empty($collection_id) ? 'default' : $collection_id,
'compare' => '='
],
$meta_query_params = [
[
'key' => '_option_taxonomy_id',
'value' => $taxonomy_id,
'compate' => '='
]
]
];
if ( !empty($collection_id) && $collection_id !== 'default' ) {
$meta_query_params[] = [
'key' => 'collection_id',
'value' => $collection_id,
'compare' => '='
];
}
$metas = $this->metadatum_repository->fetch(array(
'meta_query' => $meta_query_params
), 'OBJECT' );
if ( !empty($metas) ) {
foreach( $metas as $meta ) {
$meta_query[] = array(
'key' => $metas[0]->get_id(),
'key' => $meta->get_id(),
'value' => $terms_id,
'label' => $terms_name,
);
}
}
}
foreach($meta_query as $meta) {