Use get_the_terms instead of wp_get_post_terms to take advantage of caching

This commit is contained in:
Lee Willis 2016-08-25 18:26:37 +01:00
parent e3d5419b97
commit 9a1aa1fd93
1 changed files with 1 additions and 1 deletions

View File

@ -646,7 +646,7 @@ class WC_Product_Variation extends WC_Product {
// Get terms for attribute taxonomy or value if its a custom attribute // Get terms for attribute taxonomy or value if its a custom attribute
if ( $attribute[ 'is_taxonomy' ] ) { if ( $attribute[ 'is_taxonomy' ] ) {
$post_terms = wp_get_post_terms( $this->id, $attribute[ 'name' ] ); $post_terms = get_the_terms( $this->id, $attribute[ 'name' ] );
foreach ( $post_terms as $term ) { foreach ( $post_terms as $term ) {
if ( $variation_selected_value === $term->slug ) { if ( $variation_selected_value === $term->slug ) {