I’m using ACF to add custom fields to a User. I’m trying to output these fields to the front-end. I was able to pull all fields, but when I was trying to get the img it wouldn’t pull.
Here’s my code:
<?php $user_id = get_query_var( 'author' ) ?>
<?php $clan_member_info = get_userdata($user_id); ?>
<p><?php if(!empty($clan_member_info->psn_id)) echo '<li>' . $clan_member_info->psn_id . '</li>'; ?></p> //Example of me pulling a text field
<?php if(!empty($clan_member_info->cover_photo)) echo '<img src="'.$clan_member_info->cover_photo.'"/>'; ?>
The example of the psn_id
pulls perfectly. The img returns this <img src="https://wordpress.stackexchange.com/questions/229180/95">
.
In the User section in WP, for my own User I uploaded a photo to the field. In the ACF field group I have the field to get “Image URL”. I was hoping, if you look at the code, to spit the url
into the src
and output the img
.
If I’m missing any data, I could provide a full pastebin url of the php file.