Hoping someone can help me with this code. This code outputs the tax as a class for my isotope filte/items. It works fine on localhost but once uploaded it still works but creates the following error:

\*Warning: Invalid argument supplied for foreach() in /path-to-file.php on line #
\* 

```
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); 
  $termsArray = get_the_terms( $post->ID, "print_type" );  //Get terms for item
  $termsString = ""; //initialize string that will contain the terms
    foreach ( $termsArray as $term ) { // for each term 
    $termsString .= $term->slug.' '; //create a string that has all the slugs 
    }
?> 
   <div class="<?php echo $termsString; ?>"> 
   </div> 
<?php endwhile; ?>

```