Title: Conditional statement with array value always false
Last modified: August 20, 2016

---

# Conditional statement with array value always false

 *  [Felix](https://wordpress.org/support/users/ltse/)
 * (@ltse)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/conditional-statement-with-array-value-always-false/)
 * Hey, I’m trying to get a conditional statement with
 * <?php $info= get_post_meta($post->ID, ‘info’); if ( isset($info[‘test’]) ) { ?
   >
 * but its always a false. Any ideas?
 * [http://wordpress.org/extend/plugins/custom-fields-creator/](http://wordpress.org/extend/plugins/custom-fields-creator/)

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

 *  Plugin Contributor [madalin.ungureanu](https://wordpress.org/support/users/madalinungureanu/)
 * (@madalinungureanu)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/conditional-statement-with-array-value-always-false/#post-3260198)
 * Hi!
    CFC always stores it’s data as serialized array( array ) even if you only
   have one entry or you set up a single entry meta box, so it should be if( <?php
   $info= get_post_meta($post->ID, ‘info’, true); if ( isset($info[0][‘test’]) ){?
   >
 *  Thread Starter [Felix](https://wordpress.org/support/users/ltse/)
 * (@ltse)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/conditional-statement-with-array-value-always-false/#post-3260244)
 * Thanks for your reply. Sadly, that method will always return a true (might be
   the php version and isset problem with multidimensional arrays?)
 * Anyway, this will do the trick even though it’s not pretty:
 *     ```
       <?php $info = get_post_meta($post->ID, 'info', true);  foreach($info as $info) { 
   
        if ($info['test']) { echo 'true'; } else { echo 'false'; }
   
         }  ?>
       ```
   

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

The topic ‘Conditional statement with array value always false’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-fields-creator.svg)
 * [Custom Fields Creator](https://wordpress.org/plugins/custom-fields-creator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-fields-creator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-fields-creator/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-fields-creator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-fields-creator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-fields-creator/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Felix](https://wordpress.org/support/users/ltse/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/conditional-statement-with-array-value-always-false/#post-3260244)
 * Status: not resolved