From 6bf077a367dc7d3d326e6e3acee9966e8de085e0 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 17 Oct 2016 17:04:24 +0100 Subject: [PATCH] Sanitize ids later --- includes/wc-product-functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/wc-product-functions.php b/includes/wc-product-functions.php index 70d16c43294..bd115204ff2 100644 --- a/includes/wc-product-functions.php +++ b/includes/wc-product-functions.php @@ -765,7 +765,7 @@ function wc_get_related_products( $product_id, $limit = 5, $exclude_ids = array( global $wpdb; $product_id = absint( $product_id ); - $exclude_ids = array_map( 'absint', array_merge( array( 0, $product_id ), $exclude_ids ) ); + $exclude_ids = array_merge( array( 0, $product_id ), $exclude_ids ); $transient_name = 'wc_related_' . $product_id; $related_posts = get_transient( $transient_name ); $limit = $limit > 0 ? $limit : 5; @@ -834,9 +834,9 @@ function wc_get_related_products_query( $cats_array, $tags_array, $exclude_ids, global $wpdb; // Arrays to string. - $exclude_ids = implode( ',', $exclude_ids ); - $cats_array = implode( ',', $cats_array ); - $tags_array = implode( ',', $tags_array ); + $exclude_ids = implode( ',', array_map( 'absint', $exclude_ids ) ); + $cats_array = implode( ',', array_map( 'absint', $cats_array ) ); + $tags_array = implode( ',', array_map( 'absint', $tags_array ) ); $limit = absint( $limit ); $query = array();