Skip to content

Instantly share code, notes, and snippets.

@LaxusCroco
Last active May 28, 2025 13:52
Show Gist options
  • Save LaxusCroco/a748352207c3e08ac2187c16e4dfd980 to your computer and use it in GitHub Desktop.
Save LaxusCroco/a748352207c3e08ac2187c16e4dfd980 to your computer and use it in GitHub Desktop.
Replace 1305 with the filter ID
<?php
add_filter( 'jet-smart-filters/filters/filter-options', function( $options, $filter_id ){
if ( 1305 == $filter_id ) {
uasort( $options, '__compare_jsf' );
}
return $options;
}, 0, 2 );
function __compare_jsf( $a, $b ) {
$a = (int) $a;
$b = (int) $b;
if ( $a >= $b ) {
$c = 1;
} else {
$c = -1;
}
return $c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment