灵感来自:获取州名称而不是 Woocommerce 中的代码 在我的帐户页面上的编辑帐单和送货地址部分显示自定义字段数据的预览在朋友 @LoicTheAztec 的回答中,我打算显示该名称我的帐户页面的“国家/地区”部分(编辑帐单和送货地址) 包含以下代码,但它只显示国家/地区代码而不是完整的国家/地区名称:`
<?php
$custom_user_meta = get_user_meta(get_current_user_id(), 'billing_country', true);
if( ! empty($custom_user_meta) )
{ ?>
<p> <?php
printf( '<strong>Country / Region:</strong> ' . esc_html( '%s' ), esc_html($custom_user_meta) );?>
</p> <?php
}
?>
` 我也要求以同样的方式显示发货国家/地区的名称。
我非常感谢您能指导我。
繁星coding