You should no longer use the legacy function parameter format. Instead, as the documentation says, use the get_terms( $args )
format:
Since 4.5.0, taxonomies should be passed via the ‘taxonomy’ argument
in the $args
array:
$terms = get_terms( array(
'taxonomy' => 'post_tag',
'hide_empty' => false,
) );
And as for getting only the terms assigned to the current or a specific post, you can either use the object_ids
parameter with get_terms()
, or simply use get_the_terms()
.
So for examples:
$post_id = get_the_ID();
$countries = get_terms( array(
'taxonomy' => 'country',
'object_ids' => $post_id, // set the object_ids
) );
// Or just use get_the_terms():
$countries = get_the_terms( $post_id, 'country' );