Forums

Code to hide empty custom fields in profile? (3 posts)

  1. jillsays
    Member
    Posted 2 years ago #

    Hi,
    Before you flame me, I have been searching for this in the forums for the last half hour and have come up empty handed!

    The question: I've added some custom fields to the wordpress User Profile. I can't figure out how to hide them from the profile page if they're empty (if the user didn't fill them out).

    This is the code I'm currently using to display the field:
    <?php echo $user->favmus; ?>

    I can't get the "IF" part of the code quite right. Can anyone help me out? Thank you!

  2. Utkarsh Kukreti
    Member
    Posted 2 years ago #

    Try
    if(isset($user->favmus)) echo $user->favmus;

  3. jillsays
    Member
    Posted 2 years ago #

    Thank you for responding. However --- the field is still showing up blank with that code.

Topic Closed

This topic has been closed to new replies.

About this Topic