Merge pull request #15590 from woocommerce/fix/15584

Prevent error in wc_get_product_term_ids
This commit is contained in:
Mike Jolley 2017-06-13 11:43:00 +01:00 committed by GitHub
commit 3d50d1468c
1 changed files with 1 additions and 1 deletions

View File

@ -883,7 +883,7 @@ function wc_get_related_products( $product_id, $limit = 5, $exclude_ids = array(
*/
function wc_get_product_term_ids( $product_id, $taxonomy ) {
$terms = get_the_terms( $product_id, $taxonomy );
return ! empty( $terms ) ? wp_list_pluck( $terms, 'term_id' ) : array();
return ( empty( $terms ) || is_wp_error( $terms ) ) ? array() : wp_list_pluck( $terms, 'term_id' );
}
/**