From 3b3bd067d0ff2671fca2890c14428c97e1011a2b Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 11 Feb 2026 03:20:21 +0000
Subject: [PATCH] =Hey guess what? Meta->set() and Meta->setAll() doesn't actually save the meta to the database. Went through the files and added a ->save() call after every set

---
 inc/managers/queue/executors/UploadExecutor.php |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/inc/managers/queue/executors/UploadExecutor.php b/inc/managers/queue/executors/UploadExecutor.php
index 653fd31..1d42036 100644
--- a/inc/managers/queue/executors/UploadExecutor.php
+++ b/inc/managers/queue/executors/UploadExecutor.php
@@ -458,8 +458,11 @@
 			if (!$found) {
 				error_log('Could not find a gallery upload field for post '.$ID);
 			}
+
+			$meta->save();
 		}
 
+
 		return [
 			'ID'	=> $ID,
 			'usedUploads' => $uploadIds
@@ -664,6 +667,8 @@
 			$allIds = array_unique(array_merge($existingIds, $attachmentIds));
 			$meta->set($data['field_name'], implode(',', $allIds));
 		}
+
+		$meta->save();
 	}
 
 	private function updateFieldValue(array $data, array $results): void
@@ -683,6 +688,7 @@
 		$allIds = array_unique(array_merge($existingIds, $attachmentIds));
 
 		$meta->set($data['field_name'], implode(',', $allIds));
+		$meta->save();
 	}
 
 	private function getMetaManager(array $data): ?Meta
@@ -745,12 +751,14 @@
 		} elseif (str_starts_with($mimeType, 'video/')) {
 			$meta = Meta::forPost($postId);
 			$meta->set('video', $attachmentId);
+			$meta->save();
 		} else {
 			$meta = Meta::forPost($postId);
 			$existing = $meta->get('documents');
 			$existingIds = !empty($existing) ? explode(',', $existing) : [];
 			$existingIds[] = $attachmentId;
 			$meta->set('documents', implode(',', $existingIds));
+			$meta->save();
 		}
 	}
 

--
Gitblit v1.10.0