Failsafe for when get_the_terms() returns false. Closes #3147
Thanks @arminrosu!
This commit is contained in:
parent
dce7425a3b
commit
7d9d1ee2f0
|
@ -181,6 +181,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Fix - Better backwards compatibility with _woocommerce_exclude_image
|
||||
* Fix - is_on_sale() method now returns true for products with a sale product of 0
|
||||
* Fix - Changed MyException to Exception in Checkout class as MyException class does not exist in WooCommerce
|
||||
* Fix - For when get_the_terms() returns false inside woocommerce_get_product_terms()
|
||||
* Refactor - Taken out Piwik integration, use http://wordpress.org/extend/plugins/woocommerce-piwik-integration/ from now on
|
||||
* Refactor - Taken out ShareYourCart integration, use http://wordpress.org/extend/plugins/shareyourcart/ from now on
|
||||
* Refactor - Moved woocommerce_get_formatted_product_name function into WC_Product class
|
||||
|
|
|
@ -1479,6 +1479,10 @@ function woocommerce_get_product_terms( $object_id, $taxonomy, $fields = 'all' )
|
|||
|
||||
$terms = array();
|
||||
$object_terms = get_the_terms( $object_id, $taxonomy );
|
||||
|
||||
if ( ! is_array( $object_terms ) )
|
||||
return array();
|
||||
|
||||
$all_terms = array_flip( get_terms( $taxonomy, array( 'menu_order' => 'ASC', 'fields' => 'ids' ) ) );
|
||||
|
||||
switch ( $fields ) {
|
||||
|
|
Loading…
Reference in New Issue