From 392184512df6f6ec0bf6b88ae7d53433c5d9e80c Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Wed, 5 Oct 2022 11:00:37 -0300 Subject: [PATCH] feat: exclude default metadata section if present in `post__not_in` --- src/classes/repositories/class-tainacan-metadata-sections.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/classes/repositories/class-tainacan-metadata-sections.php b/src/classes/repositories/class-tainacan-metadata-sections.php index ff86ca281..709789913 100644 --- a/src/classes/repositories/class-tainacan-metadata-sections.php +++ b/src/classes/repositories/class-tainacan-metadata-sections.php @@ -295,7 +295,9 @@ class Metadata_Sections extends Repository { $args['meta_query'][] = $meta_query; $results = $this->fetch( $args, 'OBJECT' ); } - $results[] = $this->get_default_section($collection->get_id()); + 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,