Fix escaping in RSS excerpts and descriptions
This commit is contained in:
parent
3c771004b5
commit
646b51b8ab
@ -376,6 +376,24 @@ if ( get_option( 'fictioneer_enable_theme_rss' ) ) {
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures RSS excerpts are valid in XML
|
||||
*
|
||||
* @since 5.21.1
|
||||
*
|
||||
* @param string $excerpt The current post excerpt for the RSS feed.
|
||||
*
|
||||
* @return string The modified excerpt for the RSS feed.
|
||||
*/
|
||||
|
||||
function fictioneer_filter_rss_excerpt( $excerpt ) {
|
||||
$excerpt = wp_strip_all_tags( $excerpt );
|
||||
$excerpt = esc_html( $excerpt );
|
||||
|
||||
return $excerpt;
|
||||
}
|
||||
add_filter( 'the_excerpt_rss', 'fictioneer_filter_rss_excerpt' );
|
||||
|
||||
// =============================================================================
|
||||
// OUTPUT RSS
|
||||
// =============================================================================
|
||||
|
@ -89,7 +89,7 @@ do_action( 'rss_tag_pre', 'rss2' );
|
||||
<channel>
|
||||
|
||||
<title><?php echo $title; ?></title>
|
||||
<description><?php echo $description; ?></description>
|
||||
<description><![CDATA[<?php echo $description; ?>]]></description>
|
||||
<language><?php echo bloginfo_rss( 'language' ); ?></language>
|
||||
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
|
||||
<link><?php bloginfo_rss( 'url' ); ?></link>
|
||||
|
@ -71,7 +71,7 @@ do_action( 'rss_tag_pre', 'rss2' );
|
||||
<channel>
|
||||
|
||||
<title><?php echo $title; ?></title>
|
||||
<description><?php echo $description; ?></description>
|
||||
<description><![CDATA[<?php echo $description; ?>]]></description>
|
||||
<language><?php echo bloginfo_rss( 'language' ); ?></language>
|
||||
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
|
||||
<link><?php echo esc_url( get_permalink( $story_id ) ); ?></link>
|
||||
|
Loading…
x
Reference in New Issue
Block a user