Added the 'after_gmt' and 'before_gm' parameters

This commit is contained in:
TimBHowe 2020-10-28 20:31:10 -04:00 committed by Tim Howe
parent 0d59195657
commit 98af7209da
1 changed files with 12 additions and 0 deletions

View File

@ -300,6 +300,18 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
$args['date_query'][0]['after'] = $request['after'];
}
// Set before_gmt into date query. Date query must be specified as an array of an array.
if ( isset( $request['before_gmt'] ) ) {
$args['date_query'][0]['before'] = $request['before_gmt'];
$args['date_query']['column'] = 'post_date_gmt';
}
// Set after_gmt into date query. Date query must be specified as an array of an array.
if ( isset( $request['after_gmt'] ) ) {
$args['date_query'][0]['after'] = $request['after_gmt'];
$args['date_query']['column'] = 'post_date_gmt';
}
// Force the post_type argument, since it's not a user input variable.
$args['post_type'] = $this->post_type;