为foreach()不一致提供的参数无效

I am relatively new to WordPress and am confused by the error I am getting with the attached code. It runs okay returning the count but throws the above warning. It does not throw the error on my localhost and I have similar loops running on the same page with no warning:

<?php  
$typecount = 0;
$deal_name = "Wing Night";

$args = array( 'post_type' => 'dealdetails', 'posts_per_page' => -1  );
query_posts( $args );

while ( have_posts() ) : the_post();
      ?>
      <?php
        $deal_type = get_field('deal_type');
        foreach($deal_type as $x => $x_value){
        if($x_value == $deal_name){
        $typecount++;
        }
      }
    ?>
    <?php
endwhile;
echo '(' . $typecount. ')';
?>

You're trying to use foreach for non-array variable. get_field() may return non-array values.

Here is some fixing for you:

    $deal_type = get_field('deal_type');

    if(is_array($deal_type)){
       foreach($deal_type as $x => $x_value){
          if($x_value == $deal_name){
             $typecount++;
          }
       }
    }else{
       if($x_value == $deal_name){
          $typecount += 1;
       }
    }