ACF无法使用用户字段

问题描述

我对wordpress和acf完全陌生,我正在尝试在帖子中使用用户字段来显示帖子的作者。我试图以编程方式将帖子作者ID作为元属性添加到wp_postMeta表中,如下所示:

update_field('video_author',get_current_user_id(),$post_id);

但是,未显示帖子作者:

enter image description here

我在做什么错了?

此外,当我单击用户字段时,未列出任何用户。我假定acf在“ wp_users”或“ users”表中查找用户,这两个表均包含记录。但是,显示如下:

enter image description here

谢谢。

解决方法

检查字段元素时,您会发现诸如field_59c383916102a之类的键

update_field( 'field_59c383916102a',get_current_user_id(),$post_id ); 
//Replace field_59c383916102a with your key value