Ordering posts by custom taxonomy in admin area

Here is what I do to sort my custom post type by custom taxonomy in the admin. I have a custom post type called plugin_filter and a custom taxonomy assigned to it called filter_group. I add the following filter to my plugin to make the field sortable.

add_filter("manage_edit-plugin_filter_sortable_columns", 'plugin_filter_sort');
function plugin_filter_sort($columns) {
   $custom = array(
       'taxonomy-filter_group' => 'taxonomy-filter_group'
   );
   return wp_parse_args($custom, $columns);
}

Leave a Comment