How to display non-hierarchical taxonomy as terms with checkboxes?

I’d like to have a non-hierarchical custom taxonomy displayed in the add/edit posts admin screen for a custom post type. Obviously, when the custom taxonomy is non-hierarchical, the meta box that’s displayed is similar to the tags – it’s a text field with the auto-suggest.

However, I’m more interested in having a flat, non-hierarchical taxonomy display as a list of checkbox terms. In essence, I’d like it’s functionality to be the same as categories, with the exception that child terms could not be added.

Surely this is something that other developers have done, but the normal Google searches haven’t returned much for me. Apparently this was the default behavior when custom taxonomies were originally introduced in v2.8.

Example of non-hierarchical taxonomy with checkboxes

I’m really not looking for a plugin solution, however code examples from plugins would be fine. When developing sites for client’s it is often beneficial to allow them to see the list of pre-established terms for a certain post type. The customer should be allowed to add additional terms, just not additional child terms.

7 s
7

I’m not sure, if you already found a solution for this, but when I searched for a similar one yesterday, I found this tutorial on WPtuts very helpful. It uses radio buttons, but you can easily modify it to get it working with checkboxes as well.
http://wp.tutsplus.com/tutorials/creative-coding/how-to-use-radio-buttons-with-taxonomies/

Leave a Comment