feat: exclude default metadata section if present in `post__not_in`

This commit is contained in:
vnmedeiros 2022-10-05 11:00:37 -03:00
parent 61d570f0e6
commit 392184512d
1 changed files with 3 additions and 1 deletions

View File

@ -295,7 +295,9 @@ class Metadata_Sections extends Repository {
$args['meta_query'][] = $meta_query;
$results = $this->fetch( $args, 'OBJECT' );
}
if ( !isset($args['post__not_in']) || !in_array(\Tainacan\Entities\Metadata_Section::$default_section_slug, $args['post__not_in']) ) {
$results[] = $this->get_default_section($collection->get_id());
}
return $this->order_result(
$results,