Title: Incorrect sorting order
Last modified: December 15, 2016

---

# Incorrect sorting order

 *  Resolved [Timothy Couckuyt](https://wordpress.org/support/users/devplus_timo/)
 * (@devplus_timo)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/incorrect-sorting-order/)
 * Hey guys,
 * You should consider adding a CAST statement to the meta_value in the ORDER BY
   clause… Otherwise ordering won’t ever display correct results. Amazing that nobody
   has ever experienced this before 🙁
 * `$pieces['orderby'] = "ORDER BY CAST( term_meta.meta_value AS UNSIGNED )";`

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

 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/incorrect-sorting-order/#post-8556541)
 * Hi Timothy,
 * The plugin _does_ display the taxonomy in the correct order, both in the admin
   and in queries. Is it not working for you? I understand adding a CAST statement,
   but I don’t think it’s _necessary_.
 * Cheers,
    Kevin.
 *  Thread Starter [Timothy Couckuyt](https://wordpress.org/support/users/devplus_timo/)
 * (@devplus_timo)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/incorrect-sorting-order/#post-8556547)
 * Hey K,
 * You should try sorting more than 20 terms. You’ll see the term at position 10
   will be sorted right after 1 😉
 * // T
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/incorrect-sorting-order/#post-8556611)
 * Thanks a lot. V1.2.2 is coming presently.
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/incorrect-sorting-order/#post-8556693)
 * The plugin has been updated. Just wanted to say thanks again, T.
 * Cheers,
    Kevin.
 *  Thread Starter [Timothy Couckuyt](https://wordpress.org/support/users/devplus_timo/)
 * (@devplus_timo)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/incorrect-sorting-order/#post-8556815)
 * You’re most welcome!
 * // T

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

The topic ‘Incorrect sorting order’ is closed to new replies.

 * ![](https://ps.w.org/simple-taxonomy-ordering/assets/icon-256x256.jpg?rev=2489936)
 * [Simple Taxonomy Ordering](https://wordpress.org/plugins/simple-taxonomy-ordering/)
 * [Support Threads](https://wordpress.org/support/plugin/simple-taxonomy-ordering/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-taxonomy-ordering/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-taxonomy-ordering/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-taxonomy-ordering/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Timothy Couckuyt](https://wordpress.org/support/users/devplus_timo/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/incorrect-sorting-order/#post-8556815)
 * Status: resolved