Skip to content

Commit 12b6537

Browse files
authored
Allow sorting by numbers
Pull request with the solution from @chood531: #65 (comment) Fixing: #65
1 parent f0b9d11 commit 12b6537

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/class-extended-cpt.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,11 @@ public static function get_sort_field_vars( array $vars, array $sortables ): arr
475475
if ( isset( $orderby['meta_key'] ) ) {
476476
$return['meta_key'] = $orderby['meta_key'];
477477
$return['orderby'] = 'meta_value';
478-
// @TODO meta_value_num
478+
479+
if( isset( $orderby['meta_value_num'] ) && $orderby['meta_value_num'] ) {
480+
$return['orderby'] = 'meta_value_num';
481+
}
482+
479483
} elseif ( isset( $orderby['post_field'] ) ) {
480484
$field = str_replace( 'post_', '', $orderby['post_field'] );
481485
$return['orderby'] = $field;

0 commit comments

Comments
 (0)