无法访问get\u post\u元键值

无法访问get\u post\u元键值,post,get,woocommerce,meta,Post,Get,Woocommerce,Meta,我使用Woocomece产品对结果表进行了一些修改,我想从post meta key unique_代码中添加一些额外的信息,但它不能正常工作: $uniquecode = get_post_meta( $post->ID, 'unique_code' , true ); $result.='<td>' . $uniquecode. '</td>'; (this result goes in a td) $uniquecode=get\u post\u meta

我使用Woocomece产品对结果表进行了一些修改,我想从post meta key unique_代码中添加一些额外的信息,但它不能正常工作:

$uniquecode = get_post_meta( $post->ID, 'unique_code' , true ); 
$result.='<td>' . $uniquecode. '</td>'; (this result goes in a td)
$uniquecode=get\u post\u meta($post->ID,'unique\u code',true);
$result.=''$唯一代码';(该结果以td形式出现)
没有指纹

我也试过这个

$mymeta = get_post_meta( $post->ID, 'unique_code', false);

foreach($mymeta as $array) {
    if(isset($array['unique_code'])) {
        $name = $array['unique_code'];
        break;
    }
}

$result.='<td>' . $name . print_r($name ) . '</td>';(this result goes in a td)
$mymeta=get\u post\u meta($post->ID,'unique\u code',false);
foreach($mymeta作为$array){
if(isset($array['unique_code'])){
$name=$array['unique_code'];
打破
}
}
$result.=''$名称打印(名称)。“”;(该结果以td形式出现)

阵列打印1。

最终解决方案是

$key_name=get_post_custom_值($key='unique_code')

$result.=''标题:‘$键名称[0]。'

:)