Block error message in foreach loop when looping through ACF field

For those who are looking for an answer – after trial and error i found the “if” statement i was looking for. Full code as follows: $variablename = get_field(‘dcfg_global_item_select’); if ( !empty( $variablename ) ) {?> <div class=”container”> <?php foreach($variablename as $variablename2):?> <a href=”<?php echo get_page_link($variablename2 ->ID);?>”> <center> <img src=”<?php echo get_the_post_thumbnail_url($variablename2->ID, ‘medium’);?>”> </center> </a> … Read more