Hierarchical taxonomy UI

I don’t like the way the taxonomies are displayed within the WordPress admin and was wondering if anyone knew the best way to hook in and change it. Currently if I select some terms within my post those selected terms go to the top of the list and the hierarchy is broken making it visually confusing for the user.

Please see these images for an idea of what I’m talking about

Read More

enter image description here
enter image description here

I want to display the taxonomies exactly how they are displayed initially with just the correct terms ticked. Is there a way of doing this without having to edit the WordPress core directly, I can’t see any hooks for me to use.

Thank you for any help you can give!

Helen

Related posts

Leave a Reply

2 comments

  1. Backtrace

    Let’s first check where this actually happens:

    The meta box gets added on post.php and post-new.php screens.

    # inside ~/wp-admin/edit-form-advanced.php
    // TAGS:
    if ( !is_taxonomy_hierarchical($tax_name) )
        add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name ));
    // CATEGORIES:
    else
        add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name ));
    

    Then we move one file deeper into core to get to the definition/the meta box callback

    // inside ~/wp-admin/meta-boxes.php
    function post_categories_meta_box( $post, $box )
    

    The categorychecklist tab is the one that holds the list. Inside the div, we got a function named wp_popular_terms_checklist($taxonomy);.

    # inside ~/wp-admin/includes/template.php
    <li id="<?php echo $id; ?>" class="popular-category">
    <label class="selectit">
    <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php echo $disabled ?>/>
        <?php echo esc_html( apply_filters( 'the_category', $term->name ) ); ?>
    </label>
    </li>
    

    » Conclusion:

    This means, that we ain’t got a real chance to intercept this on plain server side level with WP filters/hooks and PHP.

    Doing something like…

    add_filter( 'wp_get_object_terms', '__return_empty_array', 20, 4 );
    

    … would simply disable the checked boxes completely.

    will update if I got more information and (maybe a solution)