From 275c0d74cd68677622a5431505c5c870c473063d Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 29 Mar 2026 21:40:15 +0000
Subject: [PATCH] =Seems to be working, huzzah! Added some changes for on-this-page nav
---
inc/registrar/Terms.php | 143 ++++++++++++++++++++++++-----------------------
1 files changed, 73 insertions(+), 70 deletions(-)
diff --git a/inc/registrar/Terms.php b/inc/registrar/Terms.php
index 20890dd..eb15874 100644
--- a/inc/registrar/Terms.php
+++ b/inc/registrar/Terms.php
@@ -59,7 +59,7 @@
* Whether to include the taxonomy in the REST API. Set this to true for the taxonomy to be available in the block editor.
* @var bool
*/
- public bool $show_in_rest;
+ public bool $show_in_rest = true;
/**
* To change the base url of REST API route. Default is $taxonomy.
* @var string
@@ -179,75 +179,78 @@
public function register():void
{
- $args = [
- 'labels' => $this->labels,
- 'public' => $this->public,
- 'hierarchical' => $this->hierarchical,
- ];
- if (isset($this->description)) {
- $args['description'] = $this->description;
- }
- if (isset($this->publicly_queryable)) {
- $args['publicly_queryable'] = $this->publicly_queryable;
- }
- if (isset($this->show_ui)) {
- $args['show_ui'] = $this->show_ui;
- }
- if (isset($this->show_in_menu)) {
- $args['show_in_menu'] = $this->show_in_menu;
- }
- if (isset($this->show_in_nav_menus)) {
- $args['show_in_nav_menus'] = $this->show_in_nav_menus;
- }
- if (isset($this->show_in_rest)) {
- $args['show_in_rest'] = $this->show_in_rest;
- }
- if (isset($this->rest_base)) {
- $args['rest_base'] = $this->rest_base;
- }
- if (isset($this->rest_namespace)) {
- $args['rest_namespace'] = $this->rest_namespace;
- }
- if (isset($this->rest_controller_class)) {
- $args['rest_controller_class'] = $this->rest_controller_class;
- }
- if (isset($this->show_tag_cloud)) {
- $args['show_tag_cloud'] = $this->show_tag_cloud;
- }
- if (isset($this->show_quick_edit)) {
- $args['show_quick_edit'] = $this->show_quick_edit;
- }
- if (isset($this->show_admin_column)) {
- $args['show_admin_column'] = $this->show_admin_column;
- }
- if (isset($this->meta_box_cb) && is_callable($this->meta_box_cb)) {
- $args['meta_box_cb'] = $this->meta_box_cb;
- }
- if (isset($this->meta_box_sanitize_cb) && is_callable($this->meta_box_sanitize_cb)) {
- $args['meta_box_sanitize_cb'] = $this->meta_box_sanitize_cb;
- }
- if (isset($this->capabilities)) {
- $allowed = ['manage_terms', 'edit_terms', 'delete_terms', 'assign_terms'];
- $caps = array_filter($this->capabilities, function ($cap) use ($allowed) {
- return in_array($cap, $allowed);
- }, ARRAY_FILTER_USE_KEY);
- $args['capabilities'] = $caps;
- }
- if (isset($this->query_var)) {
- $args['query_var'] = $this->query_var;
- }
- if (isset($this->update_count_callback) && is_callable($this->update_count_callback)) {
- $args['update_count_callback'] = $this->update_count_callback;
- }
- if (isset($this->default_term)) {
- $args['default_term'] = $this->default_term;
- }
- if (isset($this->sort)) {
- $args['sort'] = $this->sort;
- }
- if (isset($this->args)) {
- $args['args'] = $this->args;
- }
+
+ $args = array_filter(get_object_vars($this));
+// $args = [
+// 'labels' => $this->labels,
+// 'public' => $this->public,
+// 'hierarchical' => $this->hierarchical,
+// ];
+// if (isset($this->description)) {
+// $args['description'] = $this->description;
+// }
+// if (isset($this->publicly_queryable)) {
+// $args['publicly_queryable'] = $this->publicly_queryable;
+// }
+// if (isset($this->show_ui)) {
+// $args['show_ui'] = $this->show_ui;
+// }
+// if (isset($this->show_in_menu)) {
+// $args['show_in_menu'] = $this->show_in_menu;
+// }
+// if (isset($this->show_in_nav_menus)) {
+// $args['show_in_nav_menus'] = $this->show_in_nav_menus;
+// }
+// if (isset($this->show_in_rest)) {
+// $args['show_in_rest'] = $this->show_in_rest;
+// }
+// if (isset($this->rest_base)) {
+// $args['rest_base'] = $this->rest_base;
+// }
+// if (isset($this->rest_namespace)) {
+// $args['rest_namespace'] = $this->rest_namespace;
+// }
+// if (isset($this->rest_controller_class)) {
+// $args['rest_controller_class'] = $this->rest_controller_class;
+// }
+// if (isset($this->show_tag_cloud)) {
+// $args['show_tag_cloud'] = $this->show_tag_cloud;
+// }
+// if (isset($this->show_quick_edit)) {
+// $args['show_quick_edit'] = $this->show_quick_edit;
+// }
+// if (isset($this->show_admin_column)) {
+// $args['show_admin_column'] = $this->show_admin_column;
+// }
+// if (isset($this->meta_box_cb) && is_callable($this->meta_box_cb)) {
+// $args['meta_box_cb'] = $this->meta_box_cb;
+// }
+// if (isset($this->meta_box_sanitize_cb) && is_callable($this->meta_box_sanitize_cb)) {
+// $args['meta_box_sanitize_cb'] = $this->meta_box_sanitize_cb;
+// }
+// if (isset($this->capabilities)) {
+// $allowed = ['manage_terms', 'edit_terms', 'delete_terms', 'assign_terms'];
+// $caps = array_filter($this->capabilities, function ($cap) use ($allowed) {
+// return in_array($cap, $allowed);
+// }, ARRAY_FILTER_USE_KEY);
+// $args['capabilities'] = $caps;
+// }
+// if (isset($this->query_var)) {
+// $args['query_var'] = $this->query_var;
+// }
+// if (isset($this->update_count_callback) && is_callable($this->update_count_callback)) {
+// $args['update_count_callback'] = $this->update_count_callback;
+// }
+// if (isset($this->default_term)) {
+// $args['default_term'] = $this->default_term;
+// }
+// if (isset($this->sort)) {
+// $args['sort'] = $this->sort;
+// }
+// if (isset($this->args)) {
+// $args['args'] = $this->args;
+// }
+ unset($args['for']);
$for = array_map(function($item) { return jvbCheckBase($item);}, $this->for);
register_taxonomy(jvbCheckBase($this->taxonomy), $for, $args);
--
Gitblit v1.10.0