diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
index 39911e96f3..2cc7840051 100644
--- a/wp-includes/default-filters.php
+++ b/wp-includes/default-filters.php
@@ -56,6 +56,12 @@ foreach ( $filters as $filter ) {
add_filter($filter, 'wp_specialchars');
}
+// Format for RSS
+$filters = array('term_name_rss');
+foreach ( $filters as $filter ) {
+ add_filter($filter, 'convert_chars');
+}
+
// Display filters
add_filter('the_title', 'wptexturize');
add_filter('the_title', 'convert_chars');
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index a45dc27769..3784adb04f 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -146,17 +146,34 @@ function get_category_rss_link($echo = false, $cat_ID, $category_nicename) {
function get_the_category_rss($type = 'rss') {
$categories = get_the_category();
+ $tags = get_the_tags();
$home = get_bloginfo_rss('home');
$the_list = '';
- foreach ( (array) $categories as $category ) {
- $cat_name = convert_chars($category->name);
+ $cat_names = array();
+
+ $filter = 'rss';
+ if ( 'atom' == $type )
+ $filter = 'raw';
+
+ if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
+ $cat_names[] = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
+ }
+
+ if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
+ $cat_names[] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
+ }
+
+ $cat_names = array_unique($cat_names);
+
+ foreach ( $cat_names as $cat_name ) {
if ( 'rdf' == $type )
$the_list .= "\n\t\t\n";
if ( 'atom' == $type )
- $the_list .= sprintf( '', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $category->name ) );
+ $the_list .= sprintf( '', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $cat_name ) );
else
$the_list .= "\n\t\t\n";
}
+
return apply_filters('the_category_rss', $the_list, $type);
}
diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
index ba136ad72a..931b0973e9 100644
--- a/wp-includes/taxonomy.php
+++ b/wp-includes/taxonomy.php
@@ -594,7 +594,10 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
$value = attribute_escape($value);
} else if ( 'db' == $context ) {
$value = apply_filters("pre_term_$field", $value, $taxonomy);
- $value = apply_filters("pre_${taxonomy}_$field", $value);
+ $value = apply_filters("pre_${taxonomy}_$field", $value);
+ } else if ( 'rss' == $context ) {
+ $value = apply_filters("term_${field}_rss", $value, $taxonomy);
+ $value = apply_filters("${taxonomy}_$field_rss", $value);
} else {
// Use display filters by default.
$value = apply_filters("term_$field", $value, $term_id, $taxonomy, $context);