This post is more about custom taxonomies than it is adjusting category capabilities, but it’s probably resolved the same way. So i mention how I’d go about it after I explain what I’ve been doing.
I have a theme that has a custom post type called Members. These members need to be attached to posts at the authors choice. For instance, an admin is adding a new blog post. There are three posts in the custom post type Members: John, Jack & Jill. This post should be attached a Jill taxonomy/category.
I could solve this with a custom taxonomy, but I want the term options to be only what posts are made in Members. Problem is, I don’t want the admin to be able to add new terms here. So that big +Add New Category/Member link has to go.
I could do it with CSS but then someone smart could get around that. I need it done server side.
Removing the Functionality
As far as I can tell there’s no filter to hook into and remove that feature. It’s not an argument when registering a taxonomy so you can’t just re-register category or set it when creating a custom tax.
What you can set is what users are allowed to edit/add terms. The long route would be creating a custom user role and assigning only them. But I thought to myself, what would WordPress do if I just used a user role that doesn’t exists? So I did this:
https://gist.github.com/ChrisFlannagan/4cd3bfd0e853cda3d3f7898c59428ac2
I set edit_terms and manage_terms to ‘god’ and voila! The option is gone!
Hello, Chris. Problem is the admin menu also vanishes and we’re left with no option for inserting new taxonomy terms. How did you solve that?
Commenting again so I can follow
Hi Marquito, this method is for removing the ability to add/edit entirely. If you’d like to keep the ability to add/edit but just remove the +Add New Cat from the sidebar meta box, you’d need to do it with JS or CSS.