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