Product properties should not be accessed directly

Use WC_Product::get_id() instead of WC_Product::ID as product properties should not be accessed directly.

Fixes #20278
This commit is contained in:
Rodrigo Primo 2018-05-28 16:32:36 -03:00
parent 2ad9b00c9c
commit 5ed26df842
1 changed files with 1 additions and 1 deletions

View File

@ -702,7 +702,7 @@ function wc_get_product_attachment_props( $attachment_id = null, $product = fals
$alt_text = array( wp_strip_all_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ), $props['caption'], wp_strip_all_tags( $attachment->post_title ) );
if ( $product ) {
$alt_text[] = wp_strip_all_tags( get_the_title( $product->ID ) );
$alt_text[] = wp_strip_all_tags( get_the_title( $product->get_id() ) );
}
$alt_text = array_filter( $alt_text );