Merge pull request #16918 from woocommerce/update/16911

If sorting by date in the REST API, fallback to ID
This commit is contained in:
Claudio Sanches 2017-09-25 07:06:00 -06:00 committed by GitHub
commit 4f6a3afc2a
1 changed files with 4 additions and 0 deletions

View File

@ -268,6 +268,10 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
$args['post_parent__not_in'] = $request['parent_exclude'];
$args['s'] = $request['search'];
if ( 'date' === $args['orderby'] ) {
$args['orderby'] = 'date ID';
}
$args['date_query'] = array();
// Set before into date query. Date query must be specified as an array of an array.
if ( isset( $request['before'] ) ) {