From 5cfa0306f4f3284bee9661442ad35222a0b42fb2 Mon Sep 17 00:00:00 2001 From: splashingpixels Date: Fri, 28 Feb 2014 20:37:58 -0800 Subject: [PATCH] wc_get_product_ids_on_sale should never return post id of 0 fixes #5002 --- includes/wc-product-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-product-functions.php b/includes/wc-product-functions.php index a353cdd89ce..0a8d74efc90 100644 --- a/includes/wc-product-functions.php +++ b/includes/wc-product-functions.php @@ -161,7 +161,7 @@ function wc_get_product_ids_on_sale() { GROUP BY post.ID; " ); - $product_ids_on_sale = array_unique( array_map( 'absint', array_merge( wp_list_pluck( $on_sale_posts, 'ID' ), wp_list_pluck( $on_sale_posts, 'post_parent' ) ) ) ); + $product_ids_on_sale = array_unique( array_map( 'absint', array_merge( wp_list_pluck( $on_sale_posts, 'ID' ), array_diff( wp_list_pluck( $on_sale_posts, 'post_parent' ), array( 0 ) ) ) ) ); set_transient( 'wc_products_onsale', $product_ids_on_sale );