From efe518e47462c2c874a967f96bfc6c1c7053c175 Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Mon, 7 Jun 2021 12:28:06 -0300 Subject: [PATCH] fix: validate allow new terms of create a auto-draft item --- .../api/endpoints/class-tainacan-rest-items-controller.php | 2 +- .../metadata-types/taxonomy/class-tainacan-taxonomy.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php index cf52a9550..576586bb3 100644 --- a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php +++ b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php @@ -883,7 +883,7 @@ class REST_Items_Controller extends REST_Controller { return new \WP_REST_Response( [ 'error_message' => __( 'Please verify, invalid value(s)', 'tainacan' ), 'errors' => $item_metadata->get_errors(), - 'item_metadata' => $this->prepare_item_for_response($item_metadata, $request), + 'item_metadata' => $this->prepare_item_for_response($item_metadata->get_item(), $request), ], 400 ); } } diff --git a/src/views/admin/components/metadata-types/taxonomy/class-tainacan-taxonomy.php b/src/views/admin/components/metadata-types/taxonomy/class-tainacan-taxonomy.php index d777d08e0..3b4bf7937 100644 --- a/src/views/admin/components/metadata-types/taxonomy/class-tainacan-taxonomy.php +++ b/src/views/admin/components/metadata-types/taxonomy/class-tainacan-taxonomy.php @@ -293,8 +293,8 @@ class Taxonomy extends Metadata_Type { $item = $item_metadata->get_item(); - if ( !in_array($item->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) ) - return true; + // if ( !in_array($item->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) ) + // return true; $valid = true;