From f88c5b5cf3b5923e0e5d886d11da9bb8ddc7e693 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Fri, 23 Feb 2024 10:25:16 -0800 Subject: [PATCH] Require custom capabilities to manage/edit/delete shadow terms This prevents UI appearing in the admin without impacting the existing logic in this plugin for creating, editing, and deleting terms. Fixes #20. --- includes/taxonomy.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/taxonomy.php b/includes/taxonomy.php index a5c4c42..6a30553 100644 --- a/includes/taxonomy.php +++ b/includes/taxonomy.php @@ -67,6 +67,11 @@ function register_taxonomy( string $post_type ): void { 'publicly_queryable' => false, 'rewrite' => false, 'hierarchical' => true, + 'capabilities' => array( + 'manage_terms' => 'override_shadow_terms', + 'edit_terms' => 'override_shadow_terms', + 'delete_terms' => 'override_shadow_terms', + ), 'show_ui' => true, 'show_in_menu' => false, 'show_in_nav_menus' => false,