Title: Custom sort order
Last modified: August 21, 2016

---

# Custom sort order

 *  [The-Chairman](https://wordpress.org/support/users/the-chairman/)
 * (@the-chairman)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/custom-sort-order/)
 * I’d like to be able to specify a custom order for my CPT-onomies
 * As a simple example, if I created a CPT-onomy for days of the week, I’d like 
   to be able to order them Sunday, Monday Tuesday, etc… (as opposed to date or 
   name order).
 * I’m currently getting my terms like so:
    `$days = wp_get_object_terms($post->
   ID, 'days', array("fields" => "all"));`
 * [The entry for wp_get_object_terms()](http://codex.wordpress.org/Function_Reference/wp_get_object_terms#Argument_Options)
   suggests that `term_order` can be supplied as a sort field. There is a `term_order`
   field in the `wp_terms` table, which presumably I could hook into and set my 
   custom order using a plugin. I could then call `wp_get_object_terms` like this:
 * `$days = wp_get_object_terms($post->ID, 'days', array("fields" => "all", "orderby"
   =>"term_order", "order"=>"ASC"));`
 * However, because the taxonomies created by CPT-onomies seem to be created on-
   the-fly (i.e. aren’t stored in the `wp_terms` table), this method won’t work.
   Does anyone have any suggestions as to how I could make this happen?
 * Cheers
 * [http://wordpress.org/plugins/cpt-onomies/](http://wordpress.org/plugins/cpt-onomies/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [JudeAAZ](https://wordpress.org/support/users/judeaaz/)
 * (@judeaaz)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/custom-sort-order/#post-4305630)
 * I have exactly the same problem.
    This function, using `orderby` and `term_group`
   or `term_order`, returns unexpected results : all is unordered ! Waiting for 
   a fix…
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/custom-sort-order/#post-4305631)
 * I’m planning to devote a good amount of time on the plugin in the next week so,
   if you can be patient with me, I’ll look into it ASAP! Thanks for pointing this
   out!
 *  [JudeAAZ](https://wordpress.org/support/users/judeaaz/)
 * (@judeaaz)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/custom-sort-order/#post-4305632)
 * Thank you ! 🙂
 *  [edisonantus](https://wordpress.org/support/users/edisonantus/)
 * (@edisonantus)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/custom-sort-order/#post-4305636)
 * I have the same problem. I am not able to order it.
 *  [mpmchugh](https://wordpress.org/support/users/mpmchugh/)
 * (@mpmchugh)
 * [12 years ago](https://wordpress.org/support/topic/custom-sort-order/#post-4305643)
 * As I mentioned in this thread, “[Listing all custom post type items for each CPT-onomy item](http://wordpress.org/support/topic/listing-all-custom-post-type-items-for-each-cpt-onomy-item?replies=5)“,
   I’ve tried both of these plugins to try custom ordering a CPT-onomy, but neither
   seems to work: ‘Category Order and Taxonomy Terms Order’ and ‘Custom Taxonomy
   Order NE’.
 * Is there any way to get these to work for custom ordering CPT-onomies?
 * Thanks,
    Michael
 *  [mpmchugh](https://wordpress.org/support/users/mpmchugh/)
 * (@mpmchugh)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/custom-sort-order/#post-4305644)
 * Still looking for a way to custom order CPT-onomies.
 * Hopefully it can be fixed to work with existing taxonomy ordering plugins.
 * Thanks,
    Michael

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Custom sort order’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cpt-onomies_f2f2f2.svg)
 * [CPT-onomies: Using Custom Post Types as Taxonomies](https://wordpress.org/plugins/cpt-onomies/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cpt-onomies/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cpt-onomies/)
 * [Active Topics](https://wordpress.org/support/plugin/cpt-onomies/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cpt-onomies/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cpt-onomies/reviews/)

 * 6 replies
 * 5 participants
 * Last reply from: [mpmchugh](https://wordpress.org/support/users/mpmchugh/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/custom-sort-order/#post-4305644)
 * Status: not resolved