From 7935d26cd16a4f8f69a59a44e27a7263b60e54bf Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 14 Sep 2026 19:05:30 +0000
Subject: [PATCH] =Simple Calendar block up and running

---
 inc/integrations/SyncToPost.php |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/inc/integrations/SyncToPost.php b/inc/integrations/SyncToPost.php
index 281db8c..ca233a1 100644
--- a/inc/integrations/SyncToPost.php
+++ b/inc/integrations/SyncToPost.php
@@ -13,7 +13,6 @@
 trait SyncToPost
 {
 	use SyncTo, SyncHelpers, UserConnection;
-
 	public function addSavePost():void
 	{
 		if (!has_action('save_post', [$this, 'handleSavePost'])) {
@@ -28,6 +27,8 @@
 	{
 		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) 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');
 
@@ -70,6 +71,7 @@
 		$this->removeSavePost();
 		$this->handleTheSavePost($postID, $post, $update, $settings);
 		$this->addSavePost();
+		unset(self::$syncing['posts'][$postID]);
 	}
 	/**
 	 * Handle post save for syncing
@@ -85,6 +87,9 @@
 	 */
 	protected function handleTheSavePost(int $postID, WP_Post $post, bool $update, array $settings):void
 	{
+		if (!$this->isSetUp()) {
+			return;
+		}
 		error_log('==== ['.$this->title.']::handleTheSavePost ====');
 		$this->queueOperation(self::$syncTo, [
 			'posts'   => [$postID],
@@ -108,6 +113,9 @@
 	}
 	public function handleDeletePost(int $postID):void
 	{
+		if (!$this->isSetUp()) {
+			return;
+		}
 		if (!$this->canSync['delete']) {
 			return;
 		}

--
Gitblit v1.10.0