我尝试使用函数get\\u post\\u meta()来获取帖子的元值。然而,令我惊讶的是,它返回了一个再次包含数组的数组!因此,我查看了第二级数组,并通过以下代码获得了一个元值列表:
$postmeta = get_post_meta($resultid, \'\', true);
foreach ($postmeta as $meta_key => $v) {
foreach ($v as $kk => $meta_value) {
echo "$meta_key => $meta_value.\\n";
}
}
然而,即使我$single = true
阅读此处的文档:https://developer.wordpress.org/reference/functions/get_post_meta/ 对于同一个元键,它仍然为我提供了2个值。
E、 g.我打印了这份清单:
select_inco => fob.
select_inco => fob.
price_input_currency => usd.
price_input_currency => usd.
price_input => 58.
price_input_to => .
price_per => .
price_comments =>
My Question:
我怎么知道这两个值之间的区别是什么select_inco
和price_input_currency
哪一个是正确的?这就是我如何从表单中添加和编辑meta\\u值的方法:
update_post_meta($post_id, \'select_inco\', $_POST[\'select_inco\']);