答案 0 :(得分:3)
您可以使用 WC_Product
get_attribute()
方法使用以下内容:
global $product; // if the WC_Product object is not defined
if ( ! is_a($product, 'WC_Product') ) {
$product = wc_get_product( get_the_ID() );
}
echo '<p>' . $product->get_attribute( 'secimg' ) . '</p>';
它应该可以工作。