Support

Account

Home Forums Backend Issues (wp-admin) Sorting the results of taxonomy field

Solving

Sorting the results of taxonomy field

    • joelsss

    • February 15, 2021 at 10:24 pm

    We are trying to sort the results listed in a Taxonomy field of ACF. The words that we want to display as suggestions are added in a terms/taxonomy called Ingredients. Currently the terms are sorted alphabetically. However, we would like to implement a custom sorting rule where the results that start with the typed in part are listed on top of the list, followed by other suggestions. For example, if looking for we are searching for “sugar” the results would be something like:

    – sugar
    – sugar powder
    – brown sugar
    – palm sugar
    – …etc

    I know how to implement the sorting algorithm in PHP. However, the issue is where to place the code so that this change will be reflected in the WordPress admin panel when editing posts. I’ve added a picture to this post to visualize the part that we want to change.

    Any ideas? We’ve already tried Custom Taxonomy Order addon, but that one does not allow for custom sorting in code: https://wordpress.org/plugins/custom-taxonomy-order-ne/ and

    ACF taxonomy

    • joelsss

    • February 17, 2021 at 9:40 pm

    bump

    • joelsss

    • February 18, 2021 at 8:52 pm

    bump, here is the image link that is not working in the original post:

    https://ibb.co/f8sV2VZ

  • The only way that you can alter the order of the terms in an ACF taxonomy field would be to use acf/fields/taxonomy/query and the sorting would need to be something you could apply to a term query using the order/orderby arguments.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.