Home Forums General Issues Display custom user field


Display custom user field

    • codynew

    • December 31, 2014 at 11:26 am


    I have added a custom field to the user profiles but cant display it on the front page. I had a look at but cannot get it to work.

    My custom field is called user_facebook which has a plain text in it. Can someone help please?

    • James

    • June 11, 2015 at 5:33 pm

    Hi @codynew

    In order to display a user value on the frontend, you will need to identify the user_id and then pass this as a second parameter to the_field() function.

    You can use the following code:

     $user_ID = get_current_user_id(); 
    the_field('user_facebook', 'user_'. $user_ID);
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.