From d06854a0b4d0d2ec74f4d6f08631fa25b6e7b7d8 Mon Sep 17 00:00:00 2001 From: ahmedofali Date: Sun, 25 Mar 2018 18:28:14 +0000 Subject: [PATCH] Defining array before attempting to append to it --- includes/class-wc-cache-helper.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/class-wc-cache-helper.php b/includes/class-wc-cache-helper.php index c2fe644d1a6..052a2244073 100644 --- a/includes/class-wc-cache-helper.php +++ b/includes/class-wc-cache-helper.php @@ -217,6 +217,8 @@ class WC_Cache_Helper { if ( 'product_cat' === $taxonomy ) { $ids = is_array( $ids ) ? $ids : array( $ids ); + $clear_ids = array(); + foreach ( $ids as $id ) { $clear_ids[] = $id; $clear_ids = array_merge( $clear_ids, get_ancestors( $id, 'product_cat', 'taxonomy' ) );