RistoNiinemets/wp-the-taxonomy-sort — pull request #2 by brohde (2014-04-23 23:41:03+00:00)
Title: Save order in Options API; allow themes to define which taxonomies should be sortable

Hi,

This is a great plugin! I made some modifications today to suit my needs and want to share them with you if you'd like to integrate the changes.

1) Order is stored using the Options API. Currently you are storing the taxonomy order using post meta which is incorrect. Taxonomies do not have custom meta and you are actually storing the order on post objects. This is updated to store the order as options. For example, the category taxonomy order is now stored under the option 'thets_category'. Note: integrating this change will break defined sort orders for existing plugin users because I did not code a migration from posts meta to the Options API.

2) I added a filter that can be optionally used to exclude all but the defined taxonomies. If the filter is not used, all taxonomies will be sortable.

```php
/**
* Define sortable taxonomies
*/
function newsroom_thets_define_taxonomies() {
return array(
'media_gallery_category’
);
}
add_filter( 'the_taxonomy_sort_define_taxonomies', 'newsroom_thets_define_taxonomies' );
```