wp/wp-includes/feed-rss2.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
--- a/wp/wp-includes/feed-rss2.php	Tue Jun 09 11:14:17 2015 +0000
+++ b/wp/wp-includes/feed-rss2.php	Mon Oct 14 17:39:30 2019 +0200
@@ -5,7 +5,7 @@
  * @package WordPress
  */
 
-header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
+header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
 $more = 1;
 
 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
@@ -38,17 +38,20 @@
 >
 
 <channel>
-	<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
+	<title><?php wp_title_rss(); ?></title>
 	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
 	<link><?php bloginfo_rss('url') ?></link>
 	<description><?php bloginfo_rss("description") ?></description>
-	<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
+	<lastBuildDate><?php
+		$date = get_lastpostmodified( 'GMT' );
+		echo $date ? mysql2date( 'r', $date, false ) : date( 'r' );
+	?></lastBuildDate>
 	<language><?php bloginfo_rss( 'language' ); ?></language>
 	<sy:updatePeriod><?php
 		$duration = 'hourly';
 
 		/**
-		 * Filter how often to update the RSS feed.
+		 * Filters how often to update the RSS feed.
 		 *
 		 * @since 2.1.0
 		 *
@@ -61,7 +64,7 @@
 		$frequency = '1';
 
 		/**
-		 * Filter the RSS update frequency.
+		 * Filters the RSS update frequency.
 		 *
 		 * @since 2.1.0
 		 *
@@ -83,7 +86,9 @@
 	<item>
 		<title><?php the_title_rss() ?></title>
 		<link><?php the_permalink_rss() ?></link>
+<?php if ( get_comments_number() || comments_open() ) : ?>
 		<comments><?php comments_link_feed(); ?></comments>
+<?php endif; ?>
 		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
 		<dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator>
 		<?php the_category_rss('rss2') ?>
@@ -100,8 +105,10 @@
 		<content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
 	<?php endif; ?>
 <?php endif; ?>
+<?php if ( get_comments_number() || comments_open() ) : ?>
 		<wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
 		<slash:comments><?php echo get_comments_number(); ?></slash:comments>
+<?php endif; ?>
 <?php rss_enclosure(); ?>
 	<?php
 	/**