How do I browse WordPress Comment Feed by page? (5 posts)

  1. elado
    Posted 5 years ago #

    Can I browse a blog's comments feed further than the first page (usually 10 comments)

    I know there's a comments feed:

    and comments feed for a specific post:

    and posts feed which can be paginated:

    and the ability to pageinate comments on a post using comment-page-2 or cpage=2 on a post (not in feed).

    But how do I go to page #2 on a comments feed? Or on a specific post's comments feed?

    I tried all sorts of combinations, with no help:





    /feed?p=23&cpage=2 (that redirects to -->)

    /post-slug/feed/comment-page-2 (returns 404),


    /post-slug/comment-page-2/feed/ (returns 404)

    Is it even possible?


  2. esmi
    Forum Moderator
    Posted 5 years ago #

    There isn't a "page 2" in a feed file. The paging of the file is determined by the feed reader.

  3. elado
    Posted 5 years ago #

    I can still paginate on posts with ?paged=# parameter, I thought there's also way to see comments that way.

    My intention is to fetch all comments of a specific post via feed. Is it possible?


  4. finzend
    Posted 4 years ago #

    I'm also looking for an option to show all comments via RSS, anyone?

  5. finzend
    Posted 4 years ago #

    Ok, I've created some sort of solution...

    I've used this code to create a custom RSS feed:

    After that, I made a feed distinction for posts/comments

    function myPlugin_create_feed() {
      //header('Content-type: text/xml');
      if(is_single()) {
      } else {

    Fot my_comments_feed.php I copy-pasted the standard RSS2 Feed Template, but it still only showed the default number of items. So I changed the code, beginning at line 34:

    <?php do_action('commentsrss2_head'); ?>
    if(is_single()) {
      // activate custom query:
      global $post, $wp_query;
      $wp_query->comments = get_comments( array(
        'post_id'   => $post->ID,
        'status'    => 'approve',
        'type'      => 'comment'
      ) );
    $results = $wp_query->comments;
    foreach ($results as $result) {
      //echo $result->comment_author . "<br>\n";
      $mycomment_author = apply_filters('comment_author_rss', $result->comment_author);
      $mycomment_time = mysql2date('Y-m-d H:i:s', $result->comment_date_gmt, false);
      $mycomment_text = apply_filters('comment_text', $result->comment_content);
      $mycomment_text_rss = apply_filters('comment_text_rss', $result->comment_content);
      $mycomment_link = esc_url( apply_filters('the_permalink_rss', get_permalink() )) . "#comment-" . $result->comment_ID;
      echo "	<item>\n";
      echo "		<title>". $mycomment_author . "</title>\n";
      echo "		<link>" . $mycomment_link . "</link>\n";
      echo "		<dc:creator>" . $mycomment_author . "</dc:creator>\n";
      echo "		<pubDate>". mysql2date('D, d M Y H:i:s +0000', $mycomment_time, false) . "</pubDate>\n";
      echo "		<guid isPermaLink=\"false\">" . get_comment_guid($result->comment_ID) . "</guid>\n";
      echo "		<description>" . $mycomment_text_rss . "</description>\n";
      echo "		<content:encoded><![CDATA[" . $mycomment_text . "]]></content:encoded>\n";
      echo "	</item>\n";

    There might be a simpler solution, but this seems to work!

Topic Closed

This topic has been closed to new replies.

About this Topic