Make WordPress Core

Changeset 56490

Timestamp:
08/29/2023 10:03:25 PM (11 months ago)
Author:
joemcgill
Message:

Posts, Post Types: Reinstate missing sort_column options in get_pages().

This fixes an issue introduced in [55569] that broke sort ordering by post_modified_gmt or modified_gmt.

Props david.binda, azaozz, spacedmonkey, flixos90, joemcgill.
Fixes #59226.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r56452 r56490  
    60676067    }
    60686068
     6069
     6070
     6071
     6072
     6073
    60696074    $orderby = wp_parse_list( $parsed_args['sort_column'] );
    6070     $orderby = array_map( 'trim', $orderby );
     6075    $orderby = array_map(
     6076        static function( $orderby_field ) {
     6077            $orderby_field = trim( $orderby_field );
     6078            if ( 'post_modified_gmt' === $orderby_field || 'modified_gmt' === $orderby_field ) {
     6079                $orderby_field = str_replace( '_gmt', '', $orderby_field );
     6080            }
     6081            return $orderby_field;
     6082        },
     6083        $orderby
     6084    );
    60716085    if ( $orderby ) {
    60726086        $query_args['orderby'] = array_fill_keys( $orderby, $parsed_args['sort_order'] );
  • trunk/tests/phpunit/tests/post/getPages.php

    r55845 r56490  
    11821182        );
    11831183    }
     1184
     1185
     1186
     1187
     1188
     1189
     1190
     1191
     1192
     1193
     1194
     1195
     1196
     1197
     1198
     1199
     1200
     1201
     1202
     1203
     1204
     1205
     1206
     1207
     1208
     1209
     1210
     1211
     1212
     1213
     1214
    11841215}
Note: See TracChangeset for help on using the changeset viewer.