From 18e7e415339ccc9adf8ade562f93abef606da16d Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 26 Aug 2026 22:24:18 +0000
Subject: [PATCH] =Cache::connects throughout codebase refactored
---
checks.php | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/checks.php b/checks.php
index 25e4f80..4339047 100644
--- a/checks.php
+++ b/checks.php
@@ -37,26 +37,30 @@
function jvbTermHasPosts(int $termID, string $taxonomy):bool
{
- $cache = Cache::for('termUtility', 30*60)->connect('taxonomy');
+ $cache = Cache::for('termUtility', 'term', 30*60);
return $cache->remember(
$termID,
function() use($taxonomy, $termID) {
$taxonomy = jvbCheckBase($taxonomy);
$tax = get_taxonomy($taxonomy);
- $query = new WP_Query([
- 'post_type' => $tax->object_type,
- 'posts_per_page' => 1,
- 'fields' => 'ids',
- 'tax_query' => [
- [
- 'taxonomy' => $taxonomy,
- 'terms' => $termID
+ if ($tax) {
+ $query = new WP_Query([
+ 'post_type' => $tax->object_type,
+ 'posts_per_page' => 1,
+ 'fields' => 'ids',
+ 'tax_query' => [
+ [
+ 'taxonomy' => $taxonomy,
+ 'terms' => $termID
+ ]
]
- ]
- ]);
- $result = ($query->have_posts()) ? 'true' : 'false';
- wp_reset_postdata();
- return $result;
+ ]);
+ $result = ($query->have_posts()) ? 'true' : 'false';
+ wp_reset_postdata();
+ return $result;
+
+ }
+ return 'false';
}
);
}
--
Gitblit v1.10.0