Include tags in feeds. fixes #4537
git-svn-id: http://svn.automattic.com/wordpress/trunk@5979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
816f89fb03
commit
395ee1acad
|
@ -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');
|
||||
|
|
|
@ -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<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
|
||||
if ( 'atom' == $type )
|
||||
$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $category->name ) );
|
||||
$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $cat_name ) );
|
||||
else
|
||||
$the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
|
||||
}
|
||||
|
||||
return apply_filters('the_category_rss', $the_list, $type);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue