Preserve order from the Intuitive Custom Post Order and Custom Taxonomy Order plugins

<?php

// In the facet's settings, set the 'Sort by' setting to 'Term order'
// If you use the above code and also have WooCommerce installed, make sure you don't try to order WooCommerce taxonomies (like Product categories) with the Custom Taxonomy Order plugin interface. Instead, use the drag-and-drop ordering of terms that comes with WooCommerce itself. The above code excludes the specific way of ordering that WooCommerce uses (by term meta).

add_filter( 'get_terms_args', function( $args, $taxonomies ) {
	if ( isset( $args['term_order'] ) && 'order' !== $args['meta_key'] ) { // The second condition is needed to preserve WooCommerce ordering for product categories, by a termmeta field named "order".
		$args['orderby'] = 'term_order';
	}
	return $args;
}, 10, 2 );

add_filter( 'get_terms_orderby', function( $orderby, $query_vars, $taxonomies ) {
	return 'term_order' === $query_vars['orderby'] ? 'term_order' : $orderby;
}, 10, 3 );