From d38d825e3484d822ea3c1f0fb1df37ecf386b18a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 04 Jan 2026 19:54:16 +0000
Subject: [PATCH] =TaxonomyCreator.js debugging
---
inc/registry/PostTypeRegistrar.php | 39 ---------------------------------------
1 files changed, 0 insertions(+), 39 deletions(-)
diff --git a/inc/registry/PostTypeRegistrar.php b/inc/registry/PostTypeRegistrar.php
index 1d6c2f4..cd753c4 100644
--- a/inc/registry/PostTypeRegistrar.php
+++ b/inc/registry/PostTypeRegistrar.php
@@ -130,45 +130,6 @@
add_action('post_type_link', [$this, 'rewriteTaxonomySingle'], 15, 2);
add_filter('post_type_archive_link', [$this, 'rewriteTaxonomyArchive'], 15, 2);
}
-
- $postType = $this->post_type;
- add_action("save_post_{$this->post_type}", function($post_id, $post, $update) use ($postType) {
- if (jvbNoSaveIt($post_id, $post)) {
- return;
- }
- $this->invalidatePostCache($postType, $post, $update ? 'update' : 'create');
- }, 10, 3);
-
- add_action("delete_post", function($post_id, $post) use ($postType) {
- $post = get_post($post_id);
- if ($post && $post->post_type === $postType) {
- $this->invalidatePostCache($postType, $post, 'delete');
- }
- }, 10, 2);
-
- add_action("transition_post_status", function($new_status, $old_status, $post) use ($postType) {
- if ($post->post_type === $postType && $new_status !== $old_status) {
- $this->invalidatePostCache($postType, $post, 'status_change');
- }
- }, 10, 3);
- }
-
- protected function invalidatePostCache(string $type, $post, string $action) {
- error_log('Clearing Cache for '.print_r($type, true));
-
- $cache = CacheManager::for(jvbNoBase($type))->invalidate();
-
- // Clear related caches (taxonomies attached to this post)
- $taxonomies = get_object_taxonomies($post->post_type);
- foreach ($taxonomies as $taxonomy) {
- $terms = wp_get_post_terms($post->ID, $taxonomy, ['fields' => 'ids']);
- if (!empty($terms)) {
- CacheManager::for(jvbNoBase($taxonomy))->invalidate();
- }
- }
-
- // Trigger custom action for additional handling
- do_action("jvb_cache_invalidated_{$type}", $post, $action);
}
public function hideFromPublic(bool $is_viewable): bool
--
Gitblit v1.10.0