Jake Vanderwerf
2026-05-11 ac444cba221832c012c0435fdc8339fe9f37febb
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
@@ -91,7 +91,7 @@
    * Whether to display a column for the taxonomy on its post type listing screens. Default false
    * @var bool
    */
   public bool $show_admin_column;
   public bool $show_admin_column = true;
   /**
    * Provide a callback function for the meta box display.
    * If not set, post_categories_meta_box() is used for hierarchical taxonomies, and post_tags_meta_box() is used for non-hierarchical.
@@ -113,6 +113,14 @@
    * @var array
    */
   public array $capabilities;
   /**
    * The URL to the icon to be used for this menu. Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme — this should begin with 'data:image/svg+xml;base64,'. Pass the name of a Dashicons helper class to use a font icon, e.g.
    * 'dashicons-chart-pie'. Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS. Defaults to use the posts icon.
    * @var string
    */
   public string $menu_icon;
   /**
    * Triggers the handling of rewrites for this taxonomy. Default true, using $taxonomy as slug. To prevent rewrite, set to false. To specify rewrite rules, an array can be passed with any of these keys:
      * slug {string}      - Customize the permastruct slug. Default $taxonomy key.
@@ -179,75 +187,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);