Support

Account

Home Forums Front-end Issues get_fields always returning true Reply To: get_fields always returning true

  • Hi @tadywankenobi

    The get_fields function will return all field data, even if that field data is empty.

    You can check all the values like so:

    
    <?php 
    
    $fields = get_fields();
    $empty = true;
    
    if( !empty($fields) )
    {
    	foreach( $fields as $name => $value )
    	{
    		if( !empty($value) )
    		{
    			$empty = false;
    		}
    	}
    }
    
    echo '<pre>';
    	var_dump( $empty );
    echo '</pre>';
    die;
    
     ?>
    

    Thanks
    E