Feeds: `<comments>` is optional in RSS2, so don't include it when comments aren't present or open. Same for `<wfw:commentRss>` and `<slash:comments>`
Adds unit test. Props swissspidy, realloc, hakre, sivel. Fixes #9134. Built from https://develop.svn.wordpress.org/trunk@35506 git-svn-id: http://core.svn.wordpress.org/trunk@35470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7d09847957
commit
5e9ed67b82
|
@ -78,10 +78,13 @@ do_action( 'rss_tag_pre', 'atom' );
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
do_action( 'atom_entry' );
|
do_action( 'atom_entry' );
|
||||||
|
|
||||||
|
if ( get_comments_number() || comments_open() ) :
|
||||||
?>
|
?>
|
||||||
<link rel="replies" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/>
|
<link rel="replies" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/>
|
||||||
<link rel="replies" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link(0, 'atom') ); ?>" thr:count="<?php echo get_comments_number()?>"/>
|
<link rel="replies" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link(0, 'atom') ); ?>" thr:count="<?php echo get_comments_number()?>"/>
|
||||||
<thr:total><?php echo get_comments_number()?></thr:total>
|
<thr:total><?php echo get_comments_number()?></thr:total>
|
||||||
|
<?php endif; ?>
|
||||||
</entry>
|
</entry>
|
||||||
<?php endwhile ; ?>
|
<?php endwhile ; ?>
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -83,7 +83,9 @@ do_action( 'rss_tag_pre', 'rss2' );
|
||||||
<item>
|
<item>
|
||||||
<title><?php the_title_rss() ?></title>
|
<title><?php the_title_rss() ?></title>
|
||||||
<link><?php the_permalink_rss() ?></link>
|
<link><?php the_permalink_rss() ?></link>
|
||||||
|
<?php if ( get_comments_number() || comments_open() ) : ?>
|
||||||
<comments><?php comments_link_feed(); ?></comments>
|
<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>
|
<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>
|
<dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator>
|
||||||
<?php the_category_rss('rss2') ?>
|
<?php the_category_rss('rss2') ?>
|
||||||
|
@ -100,8 +102,10 @@ do_action( 'rss_tag_pre', 'rss2' );
|
||||||
<content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
|
<content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?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>
|
<wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
|
||||||
<slash:comments><?php echo get_comments_number(); ?></slash:comments>
|
<slash:comments><?php echo get_comments_number(); ?></slash:comments>
|
||||||
|
<?php endif; ?>
|
||||||
<?php rss_enclosure(); ?>
|
<?php rss_enclosure(); ?>
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-beta2-35505';
|
$wp_version = '4.4-beta2-35506';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue