Custom Sort Order for Custom Post Type Taxonomy

Use usort with a custom callback, like this: function compare_term_order_numbers( \WP_Term $a, \WP_Term $b ) : int { $order_number_a = get_field( ‘order_number’, $a ); $order_number_b = get_field( ‘order_number’, $b ); return strcmp( $order_number_a, $order_number_b ); } usort($terms, ‘compare_terms’ ); Note that this assumes get_field returns a plain string, not an object, that each term has … Read more