Is there a plugin or some php code to do this:
I want to disable some categories from the category box on the add/edit message page. I don’t want to delete the categories and I want to leave the disabled categories to the previously assigned posts.
Is there a plugin or some php code to do this:
I want to disable some categories from the category box on the add/edit message page. I don’t want to delete the categories and I want to leave the disabled categories to the previously assigned posts.
You must be logged in to post a comment.
I have solved the problem myself, but it is not a pretty one.
With the function attached to the
add_meta_boxes
action hook, I change the callback function that builds the category box. It replaces this function with the customized functionpost_categories_meta_box_custom
.post_categories_meta_box_custom
is a copy ofpost_categories_meta_box
fromwp-admin/includes/meta-boxes.php
. With the help of simple-html-dom the<li>...</li>
with the specified id is removed.Take a look at admin-only-categories plugin which allow you to hide certain category, chosen in the settings >> admin-only category settings panel, from all but Admin.