Merge pull request #12784 from franticpsyx/add-include-arg-to-wc_get_products

[2.7] Add 'include' arg to wc_get_products
This commit is contained in:
Mike Jolley 2017-01-09 14:58:36 +00:00 committed by GitHub
commit 9bded96fec
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',