Title: Code to hide empty custom fields in profile?
Last modified: August 19, 2016

---

# Code to hide empty custom fields in profile?

 *  [jillsays](https://wordpress.org/support/users/jillsays/)
 * (@jillsays)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/code-to-hide-empty-custom-fields-in-profile/)
 * 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!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Utkarsh Kukreti](https://wordpress.org/support/users/utkarsh/)
 * (@utkarsh)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/code-to-hide-empty-custom-fields-in-profile/#post-1222938)
 * Try
    `if(isset($user->favmus)) echo $user->favmus;`
 *  Thread Starter [jillsays](https://wordpress.org/support/users/jillsays/)
 * (@jillsays)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/code-to-hide-empty-custom-fields-in-profile/#post-1222945)
 * Thank you for responding. However — the field is still showing up blank with 
   that code.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Code to hide empty custom fields in profile?’ is closed to new replies.

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [empty](https://wordpress.org/support/topic-tag/empty/)
 * [hide](https://wordpress.org/support/topic-tag/hide/)

 * 2 replies
 * 2 participants
 * Last reply from: [jillsays](https://wordpress.org/support/users/jillsays/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/code-to-hide-empty-custom-fields-in-profile/#post-1222945)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
