Title: Hiding empty fields
Last modified: August 22, 2016

---

# Hiding empty fields

 *  Resolved [Ruzgar Dogu](https://wordpress.org/support/users/ruzgar-dogu/)
 * (@ruzgar-dogu)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/hiding-empty-fields/)
 * Hello,
 * I don’t know if this question has already been answered before, but i searched
   and couldn’t find an answer.
 * I created a field group to use at my portfolio posts. But as for some of my portfolios,
   one or two fields have no values at all. Even if they are left blank, labels 
   of these fields still remain on page with no values.
 * So i need a code to check if one field is empty, and hide the field if so.
 * Thanks in advance.
 * [https://wordpress.org/plugins/custom-field-suite/](https://wordpress.org/plugins/custom-field-suite/)

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

 *  [David](https://wordpress.org/support/users/ugotsta/)
 * (@ugotsta)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/hiding-empty-fields/#post-5295847)
 * Hey [@ruzgar](https://wordpress.org/support/users/ruzgar/),
 * Greetings! 🙂
 * I believe the answer has been posted here:
    [http://customfieldsuite.com/forums/questions/1702/only-show-if-not-empty](http://customfieldsuite.com/forums/questions/1702/only-show-if-not-empty)
 * I’ve personally used adjusted code like so:
 *     ```
       <?php
       global $cfs;
       if( $my_field = $cfs->get( 'my_field' ) ) {
         echo $my_field;
       }
       ?>
       ```
   
 * It’s also possible to hide fields when they’re empty using CSS:
 *     ```
       .cfs_my_field:empty {
         display: none;
       }
       ```
   
 * You’d just need to ensure a CSS class is provided through the code you use, in
   this case there would have to be a ‘cfs_my_field’ class added.
 * Perhaps that’ll help?
 * Cheers, David
 *  [volopolo](https://wordpress.org/support/users/volopolo/)
 * (@volopolo)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/hiding-empty-fields/#post-5295908)
 * Doesn’t work both, css and php. I try many times with different ways.

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

The topic ‘Hiding empty fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-field-suite.svg)
 * [Custom Field Suite](https://wordpress.org/plugins/custom-field-suite/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-field-suite/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-field-suite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-field-suite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-field-suite/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [volopolo](https://wordpress.org/support/users/volopolo/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/hiding-empty-fields/#post-5295908)
 * Status: resolved