diff --git a/src/classes/repositories/class-tainacan-metadata.php b/src/classes/repositories/class-tainacan-metadata.php index ee53bc489..2b67493f1 100644 --- a/src/classes/repositories/class-tainacan-metadata.php +++ b/src/classes/repositories/class-tainacan-metadata.php @@ -653,7 +653,7 @@ class Metadata extends Repository { do_action( 'register_metadata_types' ); - return array_filter($this->metadata_types, function($metadata_type) { + return array_filter($this->metadata_types, function($metadata_type) use ($output) { if ( $metadata_type != 'Tainacan\Metadata_Types\Control') { return $output === 'NAME' ? str_replace( 'Tainacan\Metadata_Types\\', '', $metadata_type ) : $metadata_type; } diff --git a/tests/test-api-metadata.php b/tests/test-api-metadata.php index e694eb453..6ef44ab5f 100644 --- a/tests/test-api-metadata.php +++ b/tests/test-api-metadata.php @@ -136,7 +136,7 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase { $data = $response_defaults->get_data(); - $this->assertCount(1, $data); + $this->assertCount(3, $data); $this->assertEquals('default', $data[0]['collection_id']); $this->assertEquals('Data 2', $data[0]['name']);