Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
[3.3.8] Image field image object always returns true
-
<?php if(get_field('image')): ?>
// returns true
<?php endif; ?>
Always returns true, even if field is empty. Thats because:<?php var_dump(get_field('image')) ?>
// returns:
// array(7) { ["id"]=> int(461) ["alt"]=> string(0) "" ["title"]=> string(4) "test" ["caption"]=> string(0) "" ["description"]=> string(4) "test" ["url"]=> bool(false) ["sizes"]=> array(7) { ["thumbnail"]=> NULL ["medium"]=> NULL ["large"]=> NULL ["thumb"]=> NULL ["thumb-cropperd"]=> NULL ["gallery"]=> NULL ["post-thumbnail"]=> NULL } }
Of course we can do:<?php $image = get_field('image'); ?>
<?php if($image['url']): ?>
// returns false
<?php endif; ?>
But it's still a bug. -
Hi wube,
Thanks for the bug, I'll get this fixed
Cheers
Elliot