WordPress taxonomy radio buttons

Question

I am trying to change the checkboxes for the terms on the backend to radiobuttons.
I found this topic: Altering the appearance of custom taxonomy inputs however wich helped me doing this.
However, this will turn ALL terms checkboxes to radio buttons.

Is it possible to apply this only for one taxonomy?

My code:

add_action('add_meta_boxes','mysite_add_meta_boxes',10,2);
function mysite_add_meta_boxes($post_type, $post) {
  ob_start();
}
add_action('dbx_post_sidebar','mysite_dbx_post_sidebar');
function mysite_dbx_post_sidebar() {
  $html = ob_get_clean();
  $html = str_replace('"checkbox"','"radio"',$html);
  echo $html;
}

thanks

0
, Maartje 3 years 2020-04-05T08:51:01-05:00 0 Answers 114 views 0

Leave an answer

Browse
Browse