【发布时间】:2019-06-11 06:44:34
【问题描述】:
我正在尝试在循环中使用 get_field 来检索一些自定义字段值,但是 使用 get_field('container', post_id) 时,该值始终为空。
我什至尝试在块文件中使用它,但发生了同样的情况。
$container = get_field('container'); // this works
$test_container = get_field('container', 144); //this returns empty, post id === 144
【问题讨论】:
-
使用
get_post(144)测试它是否可以为您检索帖子数据 -
get_post(144)返回帖子数据
标签: php wordpress advanced-custom-fields