Merge pull request #15590 from woocommerce/fix/15584
Prevent error in wc_get_product_term_ids
This commit is contained in:
commit
3d50d1468c
|
@ -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 ) {
|
function wc_get_product_term_ids( $product_id, $taxonomy ) {
|
||||||
$terms = get_the_terms( $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' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue