Display a custom taxonomy as a dropdown on the edit posts page

Unfortunately there is no way of doing this with wp_register_taxonomy(). When you register a taxonomy, the default metabox is either checkboxes (hierarchical) or as a cloud (non-hierarchical).

The only way round it is to de-register the existing metabox and add a new-one in its place. By carefully mimicking the ‘default’ metabox – you won’t have to process the data yourself, but let WordPress automatically handle adding / removing terms.

The details of how to do this are given in this answer. You may also find this GitHub repository helpful (which now includes the ability of creating terms on the fly in the new metabox). The linked resources refer to creating a metabox with radio boxes, but it could be easily adapted for drop-down menus.

Leave a Comment

tech