【发布时间】:2011-07-11 07:18:29
【问题描述】:
这有点奇怪,我正在使用“update_post_meta”来更新 Wordpress 中的自定义字段。当我运行 update_post_meta($post_id, 'Test_Field', 'Test Value');自定义字段更新没有问题但是当我使用它不更新的字符串值时:
$test_value = "Test";
echo $test_value; // No problem here
echo $post_id; // No problem here
update_post_meta($post_id, 'Test_Field', $test_value);
非常感谢您的帮助
学习
【问题讨论】:
-
双引号修复了它,但有人知道为什么吗? update_post_meta("$page_id", "Test_Field", "$test_value");
-
你是如何分配 $post_id 的?只是猜测 - 坦率地说,一切看起来都很好。