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/rest/routes/ContentRoutes.php | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/inc/rest/routes/ContentRoutes.php b/inc/rest/routes/ContentRoutes.php
index e1b457a..3d455d5 100644
--- a/inc/rest/routes/ContentRoutes.php
+++ b/inc/rest/routes/ContentRoutes.php
@@ -36,7 +36,7 @@
{
$this->cache_name = 'user_content_'.get_current_user_id();
parent::__construct();
-
+ $this->cache->clear();
$this->action = 'dash-';
$this->operation_type = 'content_update';
add_filter(BASE.'handle_bulk_operation', [$this, 'processOperation'], 10, 3);
@@ -261,6 +261,16 @@
if (Features::forContent($post_type)->has('is_calendar')) {
$args = $this->applyCalendarFilters($args, $params);
}
+ $taxonomies = array_filter($params, function($param) {
+ return str_starts_with($param, 'tax_');
+ }, ARRAY_FILTER_USE_KEY);
+ if (!empty($taxonomies)) {
+ $params['taxonomies'] = [];
+ foreach ($taxonomies as $taxonomy => $terms) {
+ $taxonomy = str_replace('tax_', '', $taxonomy);
+ $params['taxonomies'][$taxonomy] = $terms;
+ }
+ }
if (array_key_exists('taxonomies', $params)) {
$args = $this->applyTaxonomyFilters($args, $params);
}
@@ -287,7 +297,6 @@
$cache = $this->cache->get($key);
- $cache = false;
if ($cache) {
$response = new WP_REST_Response($cache);
return $this->addCacheHeaders($response);
@@ -360,7 +369,20 @@
foreach ($posts as $ID => $post_data) {
if (Features::forContent($post_data['content'])->has('is_timeline') && array_key_exists('timeline', $post_data)) {
- $results[$ID] =$this->processTimelinePost($ID, $post_data);
+ // Handle timeline posts - ensure we have a valid integer ID
+ $parent_id = (int)$ID;
+
+ // Skip if ID is invalid (0, 'null', etc would become 0)
+ if ($parent_id === 0) {
+ error_log('Invalid timeline parent ID: ' . $ID);
+ $results[$ID] = [
+ 'success' => false,
+ 'message' => 'Invalid parent post ID for timeline'
+ ];
+ continue;
+ }
+
+ $results[$ID] = $this->processTimelinePost($parent_id, $post_data);
continue;
}
if (str_starts_with($ID, 'new')) {
@@ -863,7 +885,7 @@
return $images;
}
- protected function formatTimeline(WP_Post $post):array
+ public function formatTimeline(WP_Post $post):array
{
$item = $this->prepareItem($post, true, false);
//Step 1: Get the fields that apply to all posts
--
Gitblit v1.10.0