From 1aa7c404dae63c9518468fe9b579fad819f8d871 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 13 Sep 2026 18:32:43 +0000
Subject: [PATCH] =Single Event page setup done through the new Event block. Currently working on the Simple Calendar block setup

---
 inc/integrations/SyncToPost.php |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/inc/integrations/SyncToPost.php b/inc/integrations/SyncToPost.php
index 2226604..d30867d 100644
--- a/inc/integrations/SyncToPost.php
+++ b/inc/integrations/SyncToPost.php
@@ -1,6 +1,7 @@
 <?php
 namespace JVBase\integrations;
 
+use JVBase\managers\queue\Queue;
 use JVBase\meta\Meta;
 use JVBase\registrar\Registrar;
 use WP_Post;
@@ -12,7 +13,6 @@
 trait SyncToPost
 {
 	use SyncTo, SyncHelpers, UserConnection;
-
 	public function addSavePost():void
 	{
 		if (!has_action('save_post', [$this, 'handleSavePost'])) {
@@ -21,12 +21,14 @@
 	}
 	public function removeSavePost():void
 	{
-		remove_action('save_post', [$this, 'handleSavePost'], 20, 3);
+		remove_action('save_post', [$this, 'handleSavePost'], 20);
 	}
 	public function handleSavePost(int $postID, WP_Post $post, bool $update):void
 	{
 		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
-		if (wp_is_post_revision($postID)) return;
+		if (wp_is_post_revision($postID) || wp_is_post_autosave($postID)) return;
+		if (isset(self::$syncing['posts'][$postID])) return;
+		self::$syncing['posts'][$postID] = true;
 
 		error_log('=== ['.$this->service_name.']::handleSavePost called');
 
@@ -69,6 +71,7 @@
 		$this->removeSavePost();
 		$this->handleTheSavePost($postID, $post, $update, $settings);
 		$this->addSavePost();
+		unset(self::$syncing['posts'][$postID]);
 	}
 	/**
 	 * Handle post save for syncing
@@ -103,7 +106,7 @@
 	}
 	public function removeDeletePost():void
 	{
-		remove_action('before_delete_post', [$this, 'handleSavePost'], 20, 3);
+		remove_action('before_delete_post', [$this, 'handleSavePost'], 20);
 	}
 	public function handleDeletePost(int $postID):void
 	{
@@ -127,7 +130,7 @@
 			return;
 		}
 
-		JVB()->queue()->add(
+		Queue::getInstance()->add(
 			self::$deleteFrom,
 			$userID,
 			[

--
Gitblit v1.10.0