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:
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.
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.