Introduced woocommerce_search_products_post_statuses filter

This commit is contained in:
Claudio Sanches 2019-05-28 21:05:26 -03:00
parent 2e90e9ab65
commit b5da70c74a
1 changed files with 16 additions and 6 deletions

View File

@ -1544,12 +1544,22 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
}
$post_types = $include_variations ? array( 'product', 'product_variation' ) : array( 'product' );
$post_statuses = current_user_can( 'edit_private_products' ) ? array( 'private', 'publish' ) : array( 'publish' );
$type_where = '';
$status_where = '';
$limit_query = '';
$term = wc_strtolower( $term );
/**
* Hook woocommerce_search_products_post_statuses.
*
* @since 3.7.0
* @param array $post_statuses List of post statuses.
*/
$post_statuses = apply_filters(
'woocommerce_search_products_post_statuses',
current_user_can( 'edit_private_products' ) ? array( 'private', 'publish' ) : array( 'publish' )
);
// See if search term contains OR keywords.
if ( strstr( $term, ' or ' ) ) {
$term_groups = explode( ' or ', $term );