Is there a hook which would enable an admin to disallow editors and authors from creating new categories for posts? Only admins should be able to create new categories. Editors & authors need to pick from what they're given.
1 Answer
This has to do with the capabilities tied to the current user role.
In your case you are looking for manage_categories capability.
Option 1) Install a Plugin, which enables you to edit the capabilites (Just "Members", best plugin for that in my opinion, or "user role editor".)
Option 2) WordPress has this separation already build in.
"Editors" can manage categories. "Authors" can not!
So, you only would have to give the users the "Author" role that should be enough to restrict it.
Option 3) Do it via code in your functions.php with something like:
<?php
global $pagenow, $typenow;
if(($pagenow === 'edit-tags.php') && $typenow === 'taxonomy') {
if(!current_user_can('manage_categories')) {
// Do whatever you want them to see.. redirect to home or whatever
return false;
}
}
I havent' tested the code above, but that should be the direction to go.
-
Thank you. I knew authors don't have the ability so maybe play it safe with out an extra plugin and bump everyone down a notch– CDToadJul 25, 2019 at 2:04