Skip to content

Commit

Permalink
Small cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauteri committed Oct 12, 2024
1 parent fe87883 commit da7a512
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion includes/core/classes/class-event-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,12 @@ public function adjust_event_sql(
$pieces['join'] .= ' LEFT JOIN ' . esc_sql( $table ) . ' ON ' . esc_sql( $wpdb->posts ) . '.ID='
. esc_sql( $table ) . '.post_id';
$order = strtoupper( $order );
if ( in_array( $order, array( 'DESC', 'ASC' ), true ) ) {

if ( in_array( $order, array( 'DESC', 'ASC' ), true ) ) {
// ORDERBY is an array, which allows to orderby multiple values.
// Currently, it is only allowed to order events by ONE value.
$order_by = ( is_array( $order_by ) ) ? $order_by[0] : $order_by;

switch ( strtolower( $order_by ) ) {
case 'id':
$pieces['orderby'] = sprintf( esc_sql( $wpdb->posts ) . '.ID %s', esc_sql( $order ) );
Expand Down

0 comments on commit da7a512

Please sign in to comment.