Home Forums Backend Issues (wp-admin) How to put selected Taxonomy checkboxes at top of list?


How to put selected Taxonomy checkboxes at top of list?

  • I notice, having put a Taxonomy term selector in a field, that selected checkboxes sit in the natural order in the hierarchy. This makes it difficult to immediately see checked terms.

    Is there a way to force selected terms to float to the top of the checkbox list?

  • ACF uses the built in wp_list_categories() function to show terms as checkboxes. I don’t know if you can alter the arguments for this function to do what you want. Here is the code from ACF

    		// vars
    		$args = array(
    			'taxonomy'     		=> $field['taxonomy'],
    			'show_option_none'	=> sprintf( _x('No %s', 'No terms', 'acf'), strtolower($taxonomy_obj->labels->name) ),
    			'hide_empty'   		=> false,
    			'style'        		=> 'none',
    			'walker'       		=> new ACF_Taxonomy_Field_Walker( $field ),
    		// filter for 3rd party customization
    		$args = apply_filters('acf/fields/taxonomy/wp_list_categories', $args, $field);
    		$args = apply_filters('acf/fields/taxonomy/wp_list_categories/name=' . $field['_name'], $args, $field);
    		$args = apply_filters('acf/fields/taxonomy/wp_list_categories/key=' . $field['key'], $args, $field);
    <div class="categorychecklist-holder">
    	<ul class="acf-checkbox-list acf-bl">
    		<?php wp_list_categories( $args ); ?>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.