WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/04/2015 05:46:41 PM (6 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/feed-rss2.php

    r35294 r35506  
    8484        <title><?php the_title_rss() ?></title>
    8585        <link><?php the_permalink_rss() ?></link>
     86<?php if ( get_comments_number() || comments_open() ) : ?>
    8687        <comments><?php comments_link_feed(); ?></comments>
     88<?php endif; ?>
    8789        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
    8890        <dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator>
     
    101103    <?php endif; ?>
    102104<?php endif; ?>
     105<?php if ( get_comments_number() || comments_open() ) : ?>
    103106        <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
    104107        <slash:comments><?php echo get_comments_number(); ?></slash:comments>
     108<?php endif; ?>
    105109<?php rss_enclosure(); ?>
    106110    <?php
Note: See TracChangeset for help on using the changeset viewer.