How to display custom field for a User?
-
I have created some custom fields, like image and url on User.
I want to display those custom fields values at User page. I have Template for user but when I add Meta Field Block in template and set it up for custom fields it shows nothing.
If I set text for Empty message, that text shows up instead of the value. It seems like I am missing setting up reference to custom field properly so it cannot find it so it just says that there is no value.I tried all three field types (default ‘meta; ACF field and Custom Rest Field.
How should I reference to custom filed to actually get its value in place of Meta Filed Block?
I did a test. I created filter on ‘meta_field_block_get_block_content’ to check what is actually visible at the point where custom filed is displayed.
It seems $post_id refers to the first post in User archive, not User itself, even if Custom Rest Field block is positioned outside of QueryLoop. As post is nt a user, it is understandable why custom fields are not found – they are on User not on a Post.
But how to access User custom fields?
- The topic ‘How to display custom field for a User?’ is closed to new replies.