WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know it is possible to change the WordPress category list to radio buttons in the admin panel for posts, but I would like to make the just the Parents radio buttons and the sub categories or children checkboxs... something like this.

    <li><input type="radio"> Category 1
        <ul class="children">
        <li><input type="checkbox">Category 1 - Sub Cat 1</label></li>
        <li><input type="checkbox">Category 1 - Sub Cat 2</label></li>
    <li><input type="radio"> Category 2</li>
    <li><input type="radio"> Category 3</li>
    <li><input type="radio"> Category 4
        <ul class="children">
        <li><input type="checkbox">Category 4 - Sub Cat 1</label></li>
        <li><input type="checkbox">Category 4 - Sub Cat 2</label></li>
    <li><input type="radio"> Category 5</li>

I don't really want to mess around with the core files and wondered if anyone knows a way to override the output via the theme functions or another method.

share|improve this question

migrated from stackoverflow.com Oct 2 '11 at 13:46

This question came from our site for professional and enthusiast programmers.

I'm pretty sure you could use JavaScript to do this for you very simply. I'd try this out:

function convert_root_cats_to_radio()
    global $post_type;

    if ( 'post' != $post_type )
    <script type="text/javascript">
    jQuery("#categorychecklist>li>label input").each(function(){
        this.type = 'radio';
add_action( 'admin_footer-post.php', 'convert_root_cats_to_radio' );
add_action( 'admin_footer-post-new.php', 'convert_root_cats_to_radio' );

What this does is loops through the hierarchy and converts the top level items to radio buttons. If you need to strictly enforce this, the javascript won't be a good solution because the root-level categories can still be selected under the popular tab.

Check out this plugin, too, to keep the hierarchy after saving: http://wordpress.org/extend/plugins/category-checklist-tree/

If you need something a little more enforceable, you'll need a custom plugin to that. The above mentioned plugin would event be a great place to start in that endeavor!


share|improve this answer
Answering a similar question, I'm suggesting removing the "Most used" tab: jQuery('#category-tabs .hide-if-no-js').remove(); – brasofilo Jul 14 '12 at 21:37

If the function use a walker type, then override by an extended child class of the walker.

If you do this, you can control how the child class will echo the html. You can style it the way you want it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.