add 'include' arg to wc_get_products

This commit is contained in:
Manos Psychogyiopoulos 2017-01-09 14:10:47 +02:00
parent 826b585765
commit 022fbe4183
2 changed files with 5 additions and 0 deletions

View File

@ -1075,6 +1075,10 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
$wp_query_args['paged'] = absint( $args['page'] );
}
if ( ! empty( $args['include'] ) ) {
$wp_query_args['post__in'] = array_map( 'absint', $args['include'] );
}
if ( ! empty( $args['exclude'] ) ) {
$wp_query_args['post__not_in'] = array_map( 'absint', $args['exclude'] );
}

View File

@ -61,6 +61,7 @@ function wc_get_products( $args ) {
'limit' => get_option( 'posts_per_page' ),
'offset' => null,
'page' => 1,
'include' => array(),
'exclude' => array(),
'orderby' => 'date',
'order' => 'DESC',