【发布时间】:2021-07-30 11:05:54
【问题描述】:
我在用户中创建了一个自定义字段。我想显示用户的一些详细信息。字段显示在用户中,但如果我编写一些内容并使用此方法调用字段:
the_field('user_description');
它没有显示作者存档页面中的内容。任何帮助将不胜感激:)
【问题讨论】:
标签: php html wordpress wordpress-theming advanced-custom-fields
我在用户中创建了一个自定义字段。我想显示用户的一些详细信息。字段显示在用户中,但如果我编写一些内容并使用此方法调用字段:
the_field('user_description');
它没有显示作者存档页面中的内容。任何帮助将不胜感激:)
【问题讨论】:
标签: php html wordpress wordpress-theming advanced-custom-fields
对于用户选项,您需要为the_field 使用第二个参数。第二个参数需要以user_ 开头并以用户ID 结尾。因此,要从当前用户那里检索一个选项,您可以这样做:
?php the_field('field_name', 'user_' . get_current_user_id()); ?>
【讨论】: