Get Child Category only
I am using this code to retrieve category:
$post_id = get_the_ID(); $countries = get_the_terms( $post_id, 'country' ); $fcountry = $countries->slug;
However this sometimes retrieves the parent category of the countries (in our scenario the continent). How could I make this to always output the child category (i.e. the country)?