简体   繁体   中英

Displaying User custom field in wordpress (ACF)

I made a custom field in User. I want to show some details of the user. The fields are displaying in Users but if I write some content and call the field with this method:

the_field('user_description');

It is not displaying the content in the author archive page. Any help will be highly appreciated:)

For user options you'll need to use a second argument for the the_field . The second argument need to start with user_ and end with the user ID. So, to retrieve an option from the current user, you'll do like this:

?php the_field('field_name', 'user_' . get_current_user_id()); ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM