-1

So, I just got this error on a page that is meant to show some product categories:

Fatal error: Can't use function return value in write context in /home/name/public_html/wp-content/themes/name/taxonomy-prodcat.php on line 37

On line 37 is this code:

<?php if(!empty(get_field('product_size', get_the_ID()))): ?>
                                            <p class="producttext"><span class="boldproduct">Size -</span> <?php echo get_field('product_size', get_the_ID()); ?></p>
                                        <?php endif; ?>

PHP Version 5.6.30 MySQL Version 5.6.35

I really cant find the problem. Any help ?

2 Answers2

0

You must write:

$v = get_field(...); if(!empty($v))...

VirCom
  • 3,414
  • 1
  • 10
  • 10
0
<?php 
$values = get_field( 'product_size' , get_the_ID());
if ( $values ) { ?>
    <p class="producttext"><span class="boldproduct">Size -</span> <?php echo get_field('product_size', get_the_ID()); ?></p>
<?php
} ?>
Arun
  • 1,609
  • 1
  • 15
  • 18