Check for empty terms array before current(). Closes #1807

This commit is contained in:
Coen Jacobs 2012-11-23 13:38:58 +01:00
parent 64b3af1ffc
commit fccbb18fb4
1 changed files with 1 additions and 1 deletions

View File

@ -31,7 +31,7 @@ class WC_Product_Factory {
$product_type = 'variation';
} else {
$terms = get_the_terms( $product_id, 'product_type' );
$product_type = isset( current( $terms )->name ) ? sanitize_title( current( $terms )->name ) : 'simple';
$product_type = ( ! empty( $terms ) && isset( current( $terms )->name ) ) ? sanitize_title( current( $terms )->name ) : 'simple';
}
// Filter classname so that the class can be overridden if extended.