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:
commit
9bded96fec
|
@ -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'] );
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue