Change default order to ‘date DESC’ in orders list table (#37565)

This commit is contained in:
Ron Rennick 2023-04-06 14:27:09 -03:00 committed by GitHub
commit 8be211b45b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
Default to sorting orders by date (desc) when HPOS is active.

View File

@ -365,7 +365,7 @@ class ListTable extends WP_List_Table {
$direction = strtoupper( sanitize_text_field( wp_unslash( $_GET['order'] ?? '' ) ) );
if ( ! in_array( $field, $sortable, true ) ) {
$this->order_query_args['orderby'] = 'id';
$this->order_query_args['orderby'] = 'date';
$this->order_query_args['order'] = 'DESC';
return;
}