Hiding the category editor from the custom post type editor
As we saw in the previous recipe, when we associate a new taxonomy with the book reviews custom post type, the show_ui
(Classic Editor) and show_in_rest
(Block Editor) options control the visibility of the taxonomy assignment meta box and the admin menu link to the taxonomy editor. In some cases, it is desirable to give users access to the full taxonomy editor, but only let editors choose from a controlled drop-down list when they create new entries in the custom post type editor.
This recipe shows how to hide the taxonomy interface from the post editor and how to update the custom post type meta box created in the previous recipe to assign a type to new book reviews and save this information in the site's database.
Getting ready
You should have already followed the Adding custom fields to categories recipe to have a starting point for this recipe, and the resulting plugin should still be active on your development...