Failsafe for when get_the_terms() returns false

As committed on master branch:
- 7d9d1ee2f0
This commit is contained in:
Coen Jacobs 2013-05-12 20:08:09 +02:00
parent 628677d4a0
commit c000afbe86
2 changed files with 5 additions and 0 deletions

View File

@ -175,6 +175,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - Allow layered nav to work with non pa_ prepended taxonomies
* 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 - For when get_the_terms() returns false inside woocommerce_get_product_terms()
= 2.0.9 - 02/05/2013 =
* Feature - Added is_product_taxonomy() conditonal.

View File

@ -1492,6 +1492,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 ) {