From 4074c1ef4775f1f45f5de16b1afab77a3d586427 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 11 Feb 2026 02:32:38 +0000
Subject: [PATCH] =testing upload manager racing condition for updating an image field to an empty string immediately after successfully setting the image

---
 inc/meta/Form.php |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/inc/meta/Form.php b/inc/meta/Form.php
index c76a497..9f568f4 100644
--- a/inc/meta/Form.php
+++ b/inc/meta/Form.php
@@ -745,6 +745,13 @@
 		}
 
 		$input .= '</div>'; // closes .file-upload-container
+
+		$input .= sprintf(
+			'<input type="hidden" name="%s" value="%s">',
+			esc_attr($name),
+			esc_attr(!empty($attachmentIds) ? implode(',', $attachmentIds) : '')
+		);
+
 		unset($config['description']);
 		unset($config['label']);
 		return static::fieldWrap($name, $input, $config);
@@ -1209,6 +1216,8 @@
 			$plural[1]??''
 		);
 
+		$input .= '</div>'; //Close the first div.row.btw
+
 		$config['type'] = 'selector';
 		unset($config['label']);
 		unset($config['description']);

--
Gitblit v1.10.0