I'm working on a site that will make use of a few custom taxonomies (for custom post types). I've chosen to make some of the taxonomies hierarchical because the method of inputting values (checking boxes) is more desirable for this site than the free-form input of non-hierarchical taxonomies. However, what I would really like is to be able to use radio button inputs instead of check boxes. Additionally, I'd like to remove the dropdown that is used to choose the parent item in the taxonomy. screenshot

Am I going about this the wrong way? Should I start with non-hierarchical taxonomies and modify the input methods on those instead? I'm completely open to input and will gladly answer any questions or supply more information if I can.

  • +1 Good Question. This would also be nice for a project I'm working on too. Moreover, have the custom taxonomy be a dropdown menu instead of a list of "categories".
    – Zack
    Jan 21 '11 at 19:28
  • Yeah, a dropdown would be great as well. Jan 21 '11 at 19:55
  • 1
    These two seems to be dealing with very similar issue: Custom Post Type - Taxonomy Dropdown Menu? and Need Help in Saving Taxonomy Terms
    – Michal Mau
    Jan 22 '11 at 1:43
  • Rather than trying to modify the existing metabox, what you might look into doing is removing the default metabox for the given taxonomy, then registering your own to call a custom function that displays the terms in a radio group, and this would tie in with the two links provided above by maugly.
    – t31os
    Jan 22 '11 at 14:32

Sure thing, just use CSS and the 'admin_head' hook to make it disappear. I believe this is what you are looking for?

Hierarchical taxonomy entry on WordPress post page without the parent
(source: mikeschinkel.com)

Just add the following to your theme's functions.php file or to a .php file of a plugin that you might be writing. Note that I included an 'init' hook to define the "Home" post type and the "Bath" taxonomy so others can more easily follow the example. Also note that if your taxonomy is named Baths" you'll need to change the CSS selector to be #newbaths_parent instead of #newbath_parent:

function remove_bath_parents() {
  global $pagenow;
  if (in_array($pagenow,array('post-new.php','post.php'))) { // Only for the post add & edit pages
#newbath_parent {
    echo $css;
function add_homes_and_baths() {
      'label'           => 'Homes',
      'public'          => true,
      'rewrite'         => array('slug' => 'homes'),
      'hierarchical'    => false,
  register_taxonomy('bath', 'home', array(
    'hierarchical'    => true,
    'label'           => 'Baths',
    'rewrite'         => array('slug' => 'baths' ),


So it seems I missed the radio button part of the question. Unfortunately WordPress does not make this easy but you can make it happen by using PHP output buffering (via the ob_start() and ob_get_clean() functions.) Just find a hook before the metabox is output ('add_meta_boxes') and a hook after it is output ('dbx_post_sidebar') and then search the captured HTML for 'checkbox' and replace with 'radio', echo it to the screen and yer done! Code follows:

function mysite_add_meta_boxes($post_type, $post) {
function mysite_dbx_post_sidebar() {
  $html = ob_get_clean();
  $html = str_replace('"checkbox"','"radio"',$html);
  echo $html;

And the evidence:

Screenshot showing taxonomies using radio buttons
(source: mikeschinkel.com)

  • 1
    "Look Ma, no parent field!" Mike, you got me laughing! :D
    – Michal Mau
    Jan 22 '11 at 15:52
  • @maugly - That's my default. :D Jan 22 '11 at 21:48
  • @haha - Glad you like it. :) Jan 23 '11 at 12:18
  • Fantastic, as always. Jan 23 '11 at 18:03
  • 1
    @tnorthcutt - Frankly, I'd recommend coding your own metabox. That's what I did and it's really not hard for this. Just do a view source and match <input> and <select> names and you won't even have to do anything to capture the taxonomy; WordPress will do it for you. OR, use a custom field and bypass taxonomy which might be overkill for this. Jan 24 '11 at 22:28

or, if you're lazy can use this plugin: Single Value Taxonomy UI

(I would've rather added this as a comment to Mike's answer as it mostly does the same thing - but I can't yet add comments)

  • No update in 2 years unfortunately :( This is really something WP should add core support for as many people would use one-term-per-object taxonomies if it was an option (i.e. use taxonomies rather than meta when query performance is important).
    – jerclarke
    Feb 23 '16 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.