Jake Vanderwerf
2026-09-18 a6413da67a4579866f0fd0323ddb23a7b6b9654a
inc/registrar/helpers/AddCustomFields.php
@@ -99,10 +99,14 @@
         $schema = is_array($rawSchema) ? $this->schema($rawSchema) : $rawSchema;
         $default = $config['type'] === 'repeater' ?
            $this->determineDefault($schema['schema']['properties']??[]) :
            $config['default'] ?? MetaTypeManager::getType($config['type'])['default'] ?? '';
         register_post_meta($this->registrar->getBased(), jvbCheckBase($name), [
            'single'            => true,
            'type'              => $metaType,
            'default'           => $config['default'] ?? MetaTypeManager::getType($config['type'])['default'] ?? '',
            'default'           => $default,
            'sanitize_callback' => fn($value) => (Sanitizer::sanitize($value, $config)),
            'auth_callback'     => fn($allowed, $key, $postID) => current_user_can('edit_post', $postID),
            'show_in_rest'      => $schema,
@@ -285,4 +289,16 @@
   {
   }
   protected function determineDefault(array $properties):array
   {
      $out = [];
      foreach ($properties as $prop => $value) {
         $out[$prop] = match ($value) {
            'object' => [],
            default     => ''
         };
      }
      return $out;
   }
}