Custom order of terms for custom taxonomy in admin and website

The question:

I have a custom taxonomy registered for my custom post type. I need to make it possible for a user to specify the order in which the taxonomy terms should appear (something like menu order for pages). Then when displaying the taxonomy terms on the site I will use the specified custom order to order them.

What is the best way to do it? Is there any plugin for it?

Many thanks,
Dasha

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Still looking myself.

After some exploring I decided to use the Term Menu Order plugin by @jameslafferty. This will add menu_order to the terms table and can be used across taxonomies and templates. @TheDeadMedic seems to have enhanced this functionality over here, discussing a similar issue.

Method 2

I just released a plugin to handle this issue. It’s up-to-date and I like to think it does things the right way. You can find it here: http://wordpress.org/extend/plugins/custom-taxonomy-sort/.

After installing, you just need to enter the order for the taxonomy terms and your terms will be magically sorted. Please give any feedback that you might have!

Method 3

I have a solution to this: http://wordpress.org/extend/plugins/order-up-custom-taxonomy-order/

Order ’em up, set it to auto-sort, knock ’em down!

Method 4

I’m looking for a solution for the same issue.

@dashaluna the bit of code you found only works for taxonomies that are registered like “tags”, tho in a non hierarchical order and sorts the taxonomy terms by entry order. ( that’s what i discovered, not 100% sure ).

I personally use a custom field for the terms ( provided via WooThemes Content Builder – can be done with other free plugins ) and to also use that in the front-end to sort terms ordering i will be using a plain MySQL query joining the appropriate taxonomy tables with the additional one for terms meta ( custom fields ) – It ‘ll probably work for every situation but a raw query would be slower than built-in WP Queries.

Method 5

I came across the My Category Order plugin. However this is for the WP native categories and it adds ‘My Category Order’ link to the Posts menu where you can drag and drop categories in a required order.

It can be changed (text search and replace) for a custom taxonomy.

Nevertheless, would be nice to have a dedicated plugin for custom taxonomy terms reorder or know how to code it. I would be grateful for any tips.

Thanks!

Method 6

Thank you everyone for advice and apologies, I haven’t realised that I hadn’t have selected the answer for this question.

Since I’ve asked it, I came across Category Order and Taxonomy Terms Order plugin. I mainly use this plugin for ordering.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment