Title: [mla_term_list] menu_order support?
Last modified: May 2, 2020

---

# [mla_term_list] menu_order support?

 *  Resolved [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/)
 * Have the following tree widget: `[mla_term_list taxonomy=attachment_category]`
   
   Have an issue with the att. categories not being sorted the way I want, and the
   available fields (ID, name, etc.) in the `orderby` param are not capturing the
   order desired.
 * Have briefly looked into some of the taxonomy sorters plugins over here in WP,
   like “[Simple Taxonomy Ordering](https://wordpress.org/plugins/simple-taxonomy-ordering/)”
   but they aren’t compatible with the mla_term_list in the frontend. With the power
   of MLA, still feel there should be a better “MLA way” than installing yet another
   specialized plugin.
 * Summarizing, how to enable a `menu_order` kind of column to att. categories in
   general and mla_term_list in particular? Have also tried `$attr['orderby'] = '
   menu_order';` in the `mla_term_list_attributes` filter, but get an SQL error.
 * Thanks, David!

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/mla_term_list-menu_order-support/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/mla_term_list-menu_order-support/page/2/?output_format=md)

 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12780646)
 * Good to hear from you again, and thanks for your question and the link to one
   solution. A quick search of the WordPress Repository turns up two popular plugins
   which differ in their implementation:
 * [Simple Taxonomy Ordering](https://wordpress.org/plugins/simple-taxonomy-ordering/)
 * [Custom Taxonomy Order](https://wordpress.org/plugins/custom-taxonomy-order-ne/)
 * Yours is the first request I’ve had for this feature. I am reluctant to commit
   to adding this to the MLA core plugin but I could investigate the work required
   to support one or both of the above plugins in `[mla_term_list]` and `[mla_tag_cloud]`.
   Would you be willing to accept that as an alternative?
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12780784)
 * Hi David, glad to hear from you, too. 🙂
 * Yes, of course, and thank you for your kind proposition. AFAIK, reordering is
   mostly a cosmetic endeavor that just uses a numeric `menu_order` field that seems
   fairly standard (currently I’m using it in WooCommerce). The cosmetic part could
   be done via any of those plugins mentioned, as of course understand that’s out
   the scope of MLA. The `menu_order` field though is interesting, as I have seen
   it referred in many places in MLA code, so I’m under the impression it’s already
   there, but just needs to be properly enabled for `[mla_term_list]`. Or is that`
   menu_order` serving a completely different purpose?
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12781024)
 * Thanks for the quick response; I will investigate further.
 * Regarding `menu_order`, WordPress provides this for posts, pages and Media Library
   items by supporting a database field in the `wp_posts` table. Taxonomies do not
   have an equivalent field in WordPress.
 * As I wrote in my first post, the two plugins I found add this feature in different
   ways. The “Simple Taxonomy Ordering” plugin uses the “term meta” capability added
   to WordPress v4.7+. The “Custom Taxonomy Order” adds a database column of its
   own to the `wp_term` table.
 * It looks like “Simple Taxonomy Ordering” cleans up when it’s deleted, but “Custom
   Taxonomy Order” just gives instructions for manual database modifications to 
   remove its column and options.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12782000)
 * I have uploaded a new MLA Development Version dated 20200504 that adds support
   for the Simple Taxonomy Ordering plugin. You can find step-by-step instructions
   for using the Development Version in this earlier topic:
 * [PHP Warning on media upload with Polylang](https://wordpress.org/support/topic/php-warning-on-media-upload-with-polylang/#post-9625341)
 * Once the Development Version you can add `orderby=tax_position` to your `[mla_tag_cloud]`
   or `[mla_term_list]` shortcodes to sort the list into the “drag and drop” order
   created by the Simple Taxonomy Ordering plugin.
 * It would be great if you can install the Development Version, try the new feature
   and let me know if you find any problems. Thanks for motivating this MLA enhancement,
   and for your continued interest in the plugin.
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12782223)
 * Hi David,
 * Thanks very much for the so quick availability of this new orderby feature!
 * The new feature seems to work as intended but for parent-child hierarchies only.
   It isn’t sorting right for me the grandparent-parent-child ones.
 * For example, ordered these manually in the backend:
 *     ```
       Crafts
       - Prints 
       -- A1 Prints
       -- A3 Prints
       - Woodblocks
       - Jewelboxes 
       -- Square Box
       -- Long Box
       - Cards
       ```
   
 * but getting this order instead in the frontend:
 *     ```
       Crafts
       - Woodblocks
       - Cards
       - Prints 
       -- A1 Prints
       -- A3 Prints
       - Jewelboxes 
       -- Square Box
       -- Long Box
       ```
   
 * Don’t know if matters, but I’m also filtering out some other ID’s as well (not
   displayed above). Here’s the shortcode used:
 * `[mla_term_list taxonomy=attachment_category orderby=tax_position mla_markup=
   term-list-flatsome exclude_tree='226,213,227,18089']`
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12792215)
 * Thanks for trying out the new feature and for your report.
 * I have reproduced the issue you posted and I am investigating the feasibility
   of a fix. I will post an update when I have progress to report.
 * By the way, in the course of adding and rearranging the terms you’re using in
   your example I did find that under some circumstances Simple Taxonomy Ordering
   will be unable to make the drag and drop order changes persistent. That doesn’t
   apply to your example but it happened twice in my experiments.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12805656)
 * I have uploaded a new MLA Development Version dated 20200508 that fixes the multi-
   level hierarchy sorting for the Simple Taxonomy Ordering plugin. You can find
   step-by-step instructions for using the Development Version in this earlier topic:
 * [PHP Warning on media upload with Polylang](http://PHP Warning on media upload with Polylang)
 * t would be great if you can install the Development Version and let me know if
   you find any additional problems. Thanks for helping to test out this MLA enhancement.
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12806194)
 * Thank you, David, for the 20200508 update! The multi-level hierarchy sorting 
   issue seems fixed now.
 * Also noticed the persistency issue with Simple Taxonomy Ordering on Live (Linux)
   but not so on stage (WAMP). Wasn’t able to persist at all another different branch
   of parent-child items. Started purging the cache, switching stuff off and back
   on and at some point it started working. Not yet reproducible, unfortunately.
 * Thanks again!
    Alex
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12808347)
 * Thanks for your update with the good news.
 * You wrote “**_Wasn’t able to persist at all another different branch of parent-
   child items._**” That may be the same problem I had while setting up your example.
   In some cases I found that a child term was assigned a “tax_position” number 
   lower than the parent term. When that happens the Simple Taxonomy Ordering plugin
   will not update the “tax_position” no matter how you drag and drop those terms.
   I fixed it by manually editing the database values for the broken terms, which
   was very tedious.
 * This enhancement will go out in the next MLA version. I am marking this topic
   resolved, but please update it if you have any additional problems or further
   questions about MLA support for Simple Taxonomy Ordering. Thanks again for inspiring
   this MLA enhancement.
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12829075)
 * Hi again David,
 * Just noticed a bug. When disabling the “Simple Taxonomy Ordering” plugin, the[
   mla_term_list] crashes with the following entry in debug log:
 * `WordPress database error You have an error in your SQL syntax; check the manual
   that corresponds to your MariaDB server version for the right syntax to use near''
   at line 1 for query SELECT * FROM ( SELECT t.term_id, t.name, t.slug, t.term_group,
   tt.term_taxonomy_id, tt.taxonomy, tt.description, tt.parent, COUNT(p.ID) AS`count`
   FROM`wp_terms`AS t INNER JOIN`wp_term_taxonomy`AS tt ON t.term_id = tt.term_id
   LEFT JOIN`wp_term_relationships`AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id
   LEFT JOIN`wp_posts`AS p ON ( tr.object_id = p.ID AND p.post_type IN ('attachment')
   AND p.post_status IN ('inherit') ) WHERE ( tt.taxonomy IN ('attachment_category'))
   GROUP BY tt.term_taxonomy_id ORDER BY count DESC, t.term_id ASC ) AS subQuery
   ORDER BY made by require('wp-blog-header.php'), require_once('wp-includes/template-
   loader.php'), include('/themes/flatsome/page-right-sidebar.php'), get_sidebar,
   locate_template, load_template, require_once('/themes/flatsome/sidebar.php'),
   dynamic_sidebar, WP_Widget->display_callback, MLATextWidget->widget, apply_filters('
   widget_text'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag,
   MLAShortcodes::mla_term_list_shortcode, MLAShortcode_Support::mla_term_list_shortcode,
   MLAShortcode_Support::mla_term_list, MLAShortcode_Support::mla_get_terms`
 * Also, I probably made a mistake when suggesting this plugin w/o further tests,
   as just noticed it doesn’t support sorting/ordering of pages (which I have a 
   lot of). How feasible it is now to eventually support other more advanced sorting/
   ordering plugins? There seems to be plenty of them in the WP repository. Is it
   there anything special I need to look for?
 * Thanks again!
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12829698)
 * Thanks for your report and the details from the log. I have found and corrected
   the MLA defect I introduced while adding Simple Taxonomy Ordering support. I 
   will update the Development Version shortly, but in the interim simply removing
   the `orderby=tax_position` parameter from the shortcode will avoid the problem.
 * Regarding other plugins, it’s a case-by-case investigation. The other plugin 
   I found (Custom Taxonomy Order) wouldn’t be too hard to support. If you find 
   one you really like, give me a link and I will investigate further.
 * Thanks for your help with this.
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12834923)
 * Great to know you’ve fixed the SQL issue, and thanks very much for your kind 
   willingness to add MLA compatibility with other custom sorting plugins!
 * Have looked into most of these plugins found in the WP repository (about 15 of
   them). The one that IMO stands out overall, regarding seamless WP integration
   with an uncluttering UI, support for custom taxonomies and post types as well,
   and a general sense it’s established and still well supported, is “[Simple Custom Post Order” by ColorLib](https://wordpress.org/plugins/simple-custom-post-order/).
   Visually, it behaves the same as “Simple Taxonomy Ordering” but also does pages.
   Hope you’d find it of your liking, and easy enough to integrate with MLA.
 * Thanks so much once again!
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12837326)
 * Thanks for your research into other “custom ordering” plugins.
 * I have uploaded a new MLA Development version dated 20200514 that fixes the defect
   you identified and adds support for the “Simple Custom Post Order” by ColorLib
   plugin. I have retained support for the Simple Taxonomy Ordering plugin as well.
 * It would be great if you can install the Development Version and let me know 
   if you find any additional problems. Thanks for helping to test out these MLA
   enhancements.
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12838297)
 * Thanks for the update. After upgrading MLA to 20200514, the SQL issue seems fixed,
   but the manual order via “Simple Custom Post Order” (SCPO) by ColorLib isn’t 
   working for me. The Att. Category manual order seems to get saved, but nothing
   changes in the front-end. Have tested with localhost WAMP and on linux live, 
   following the usual common-sense steps I could think of (clearing old settings
   before uninstalling the previous “Simple Taxonomy Ordering” plugin, clearing 
   cache, etc.). Nothing in the php_error.log, nor unusual in QM either.
 * The `[mla_term_list]` tag is still the same:
 * `[mla_term_list taxonomy=attachment_category orderby=tax_position mla_markup=
   term-list-flatsome exclude_tree='226,213,227,18089']`
 * The Settings > SCPOorder page has options for resetting the custom order of Post
   Types, but not of taxonomies. There’s also a “Check to see advanced view of Post
   Types” that I don’t know what it does but have enabled anyway.
 * Seems a DB incompatibility issue? Kindly advise how to debug this.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/#post-12841176)
 * Please accept my apologies for the inconvenience I’ve put you to. I neglected
   to tell you the most important part of switching from Simple Taxonomy Ordering
   to the Simple Custom Post Order plugin.
 * You must change your orderby parameter from “tax_position” to “term_order”. I
   assigned different values to make it easier for my code to tell which plugin 
   to support. I added this information to the Documentation tab but I forgot to
   add it to my earlier post in this topic.
 * Give `orderby=term_order` a try and let me know if you have any remaining issues.

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/mla_term_list-menu_order-support/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/mla_term_list-menu_order-support/page/2/?output_format=md)

The topic ‘[mla_term_list] menu_order support?’ is closed to new replies.

 * ![](https://ps.w.org/media-library-assistant/assets/icon-256x256.png?rev=973502)
 * [Media Library Assistant](https://wordpress.org/plugins/media-library-assistant/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-library-assistant/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-library-assistant/)
 * [Active Topics](https://wordpress.org/support/plugin/media-library-assistant/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-library-assistant/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-library-assistant/reviews/)

 * 16 replies
 * 2 participants
 * Last reply from: [alx359](https://wordpress.org/support/users/alx359/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/mla_term_list-menu_order-support/page/2/#post-12841224)
 * Status: resolved