The image you see below is what WordPress Core adds to the editor to assign a category to a post.
Similarly, when you register a custom hierarchical taxonomy, WordPress Core will automatically add a term selector just like the above, to the editor.
Recently I was tasked with implementing a feature where we wanted a completely customised version of the term selector, which meant – after building our own version, we no longer needed the one added by Core.
So, how do we hide a taxonomy selector that is added by Core?
For any taxonomy, core or custom, the general convention for the argument passed to this function is:
So if you wanted to hide the Category and Tag panel, the commands would be:
For a custom taxonomy, for example Gadget with the slug
gadget, the argument passed would be
You may mostly use this within a Gutenberg plugin where a panel needs to be removed on page load. The best place to add this code would be inside the
List of other panels it can remove
|Panels visible in the editor||Equivalent argument|
Hope this article helped! Thanks for reading!