From 97e7c319d656a5f05489ca996e249e7359303d4d Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 31 May 2026 22:42:33 +0000
Subject: [PATCH] =Jakevan edits done?

---
 inc/rest/Route.php |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/inc/rest/Route.php b/inc/rest/Route.php
index 4deb44a..d769c6e 100644
--- a/inc/rest/Route.php
+++ b/inc/rest/Route.php
@@ -252,7 +252,9 @@
 
 		$this->currentMethod['permission_callback'] = function(WP_REST_Request $request) use ($originalCallback, $action, $header) {
 			$nonce = $request->get_header($header);
-
+			error_log('[Route] Validating nonce....');
+			error_log('Nonce: '.print_r($nonce, true));
+			error_log('Action: '.print_r($action, true));
 			if (!wp_verify_nonce($nonce, $action)) {
 				return new WP_Error(
 					'invalid_nonce',
@@ -334,9 +336,33 @@
 			'email' => 'sanitize_email',
 			'url' => 'esc_url_raw',
 			'boolean', 'bool' => 'rest_sanitize_boolean',
+			'array' => function($value) {
+				if (is_array($value)) {
+					return $value;
+				}
+				return [];
+			},
+			'object' => function($value) {
+				if (is_array($value) || is_object($value)) {
+					return (array) $value;
+				}
+				return [];
+			},
 			default => null,
 		};
 
+		// Add validate callback for array/object types
+		if (in_array($type, ['array', 'object'])) {
+			$arg['validate_callback'] = function($value, $request, $param) {
+				// Allow empty arrays/objects
+				if (empty($value)) {
+					return true;
+				}
+				// Ensure it's an array or object
+				return is_array($value) || is_object($value);
+			};
+		}
+
 		// Parse modifiers
 		foreach (array_slice($parts, 1) as $part) {
 			$part = trim($part);

--
Gitblit v1.10.0