Forums

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

  1. jillsays
    Member
    Posted 2 months 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
    Member
    Posted 2 months ago #

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

  3. jillsays
    Member
    Posted 2 months ago #

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

Reply

You must log in to post.

About this Topic