Skip to content

Commit 0661504

Browse files
committed
fix: Added orderby params
1 parent cfde911 commit 0661504

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Core/XWC_Object_Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ protected function get_scalar_clause_value( $column, $value ) {
265265

266266
$escaped_like = $left_wildcard . $value . $right_wildcard;
267267

268-
return \sprintf( '%1$s LIKE \'%2$s\'', $column, $escaped_like );
268+
return \sprintf( '%1$s LIKE \'%2$s\' ', $column, $escaped_like );
269269
}
270270

271271
protected function get_array_clause_value( string $col, array $value ): string {

src/Repo/Query_Handler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ protected function get_base_query_args( array $vars ): array {
2525

2626
$vars['fields'] = $vars['return'] ?? 'ids';
2727
$vars['per_page'] = $vars['limit'] ?? 20;
28+
$vars['orderby'] = isset( $vars['orderby'] )
29+
? $this->cols_to_props[ $vars['orderby'] ] ?? $vars['orderby']
30+
: $this->get_id_field();
2831

2932
return \xwp_array_diff_assoc( $vars, 'return', 'limit' );
3033
}

0 commit comments

Comments
 (0)