Output terms for custom post types

Your code is wrong. I don’t know how it is working in your localhost. Cause-

  1. You are calling get_terms() with 3 parameters which actually accepts 2 parameters. The last one is extra.
  2. And secondly get_terms() returns all the terms of a taxonomy, not the terms associated with a post.

For getting the terms associated for a post you can use wp_get_post_terms.

Usage of wp_get_post_terms inside WordPress loop-

For each post you’ll get the post’s terms by calling wp_get_post_terms like below-

//Do something if a specific array value exists within a post
$term_list = wp_get_post_terms($post->ID, 'your_taxonomy', array("fields" => "all"));
// Then you can run a foreach loop to show the taxonomy terms infront.
foreach($term_list as $term_single) {
    echo $term_single->slug; //do something here
}

And for outside of the loop-

// Do something if a specific array value exists within a post
// And somehow you need to get the post ID to pas it to below.
$term_list = wp_get_post_terms($post_id, 'your_taxonomy', array("fields" => "all"));
// Then you can run a foreach loop to show the taxonomy terms infront.
foreach($term_list as $term_single) {
    echo $term_single->slug; //do something here
}

Hope that helps.