I have registered a custom tax to my CPT. On the edit screen the tax meta box appears with an autocomplete field.

Is it possible to display it as checkboxes or dropdown instead?


You probably did not set the 'hierarchical' argument to true in your register_taxonomy. This would mean that it defaults to false, which gives you a tag-like interface.

Add 'hierarchical' => true to your register_taxonomy.

  • Oh yeah... Thanks! BUT Would it now possible to change it to checkbox or even select? I want to be able to put this as setting into my plugins settings. – Julian F. Weinert Aug 7 '13 at 17:51
  • 1
    Changing hierarchical to true should change the interface to checkboxes on your edit screen for the CPT. – vancoder Aug 7 '13 at 18:06
  • Yes, it does – but I want to be able to switch between these options. I don't think that it is good practice to switch between hierarchal and not. It does not change ONLY the interface, am I right? – Julian F. Weinert Aug 7 '13 at 18:09
  • Well, hierarchical makes it... hierarchical :) You cannot switch between the 2 interfaces to my knowledge. – vancoder Aug 7 '13 at 18:33
  • This solution doesn't create a checkbox or drop down menu. – Dev Sep 12 '17 at 9:28

As of WP 3.7 (https://core.trac.wordpress.org/ticket/14206) you can add this argument to register_taxonomy:

'meta_box_cb' => 'post_categories_meta_box'

to get the built-in checkbox category style metabox without having to make your taxonomy hierarchical.

Also you could instead provide your own callback function to create your own metabox (i.e. with a dropdown).

  • 1
    Great, this is exactly what I needed without having to make the taxonomy hierarchical. Thanks – Alexander Holsgrove Dec 29 '16 at 21:20
  • The issue with this is that the non-hierarchical and hierarchical taxonomies have a different data structure that needs to be saved. For how to fix this issue see here gist.github.com/gschoppe/… – P. Galbraith Feb 27 '17 at 6:18
  • This solution doesn't create a checkbox or drop down menu. – Dev Sep 12 '17 at 9:28
  • 1
    This is huge! Thank you... I never knew it existed – Sam Holguin Feb 10 '19 at 20:00

if you want to change the term of existing plugin to checkbox you need to edit the existing register_taxonomy().

add_action( 'init', 'change_room_term_to_checkbox', 999);
function change_room_term_to_checkbox()
    $tax = get_taxonomy('roomtype');
    $tax->meta_box_cb = 'post_categories_meta_box';
    $tax->hierarchical = true;

'roomtype' is the name of term used on register_taxonomy('roomtype', array(.....

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.