Home › Forums › Feature Requests › Sort Taxonomy terms › Reply To: Sort Taxonomy terms
Indeed, it’s not possible with get_terms (get_categories) args, cause final query contains “INNER JOIN wp_termmeta” but acf doesn’t use this table
So loop through it with usort()
the shortest variant for now is
usort($terms, function($a. $b) use ($taxonomy) {
return get_field('sort_order', $taxonomy.'_'.$a->term_id) - get_field('sort_order', $taxonomy.'_'.$b->term_id);
});
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.