get_post_meta
is only for custom fields. If listing_category
and listing_type
are in fact taxonomies, you need to use get_the_terms
instead. The resulting code would be something like this:
add_action('rss2_item', 'yoursite_rss2_item');
function yoursite_rss2_item() {
if (get_post_type()=='listings') {
$fields = array(
'listing_bedrooms',
'listing_city',
);
$post_id = get_the_ID();
foreach($fields as $field) {
if ($value = get_post_meta($post_id,$field,true)) {
echo "<{$field}>{$value}</{$field}>\n";
}
}
$taxonomies = array(
'listing_category',
'listing_type'
);
// Loop through taxonomies
foreach($taxonomies as $taxonomy) {
$terms = get_the_terms($post_id,$taxonomy);
if (is_array($terms)) {
// Loop through terms
foreach ($terms as $term) {
echo "<{$taxonomy}>{$term->name}</{$taxonomy}>\n";
}
}
}
}
}
See the documentation for get_the_terms
here: http://codex.wordpress.org/Function_Reference/get_the_terms