From 7610e1311ede44b5b6f24f3e5c924dfeba972326 Mon Sep 17 00:00:00 2001 From: Ramon Date: Fri, 21 Aug 2020 14:07:26 -0300 Subject: [PATCH] Ensure that the return of get_the_terms is not a WP error --- includes/data-stores/class-wc-product-data-store-cpt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/data-stores/class-wc-product-data-store-cpt.php b/includes/data-stores/class-wc-product-data-store-cpt.php index afa4ccc0104..6158a4cad86 100644 --- a/includes/data-stores/class-wc-product-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-data-store-cpt.php @@ -1708,7 +1708,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da $product_type = 'variation'; } elseif ( 'product' === $post_type ) { $terms = get_the_terms( $product_id, 'product_type' ); - $product_type = ! empty( $terms ) ? sanitize_title( current( $terms )->name ) : 'simple'; + $product_type = ! empty( $terms ) && ! is_wp_error( $terms ) ? sanitize_title( current( $terms )->name ) : 'simple'; } else { $product_type = false; }