WordPress.org

Ready to get started?Download WordPress

Ideas

Let comments on photos (attachments) appear in the RSS feed for comments

  1. Hannes
    Member

    12345

    I think it's strange that comments on photos don't appear in the comments RSS feed.

    But they appear in the "Recent Comments" section on the dashboard. Which is good.

    Wouldn't it make sense to have comments on photos also in the RSS feed for comments?

    Posted: 5 years ago #
  2. UncleZeiv
    Member

    12345

    Same problem here, temporarily solved like this:

    function fix_comments_rss_attachments($cwhere) {
    return "WHERE comment_approved = '1'";
    }

    add_filter('comment_feed_where', 'fix_comments_rss_attachments');

    This is because in query.php the feed query for comments has 'post_status' = 'publish', but attachment usually have value 'inherit'. The correct way to solve this would be to check if the parent post is 'publish', but that would require another join and incur in additional cost. My fix just removes such additional requirement - I don't usually comment on unpublished posts!

    Posted: 4 years ago #
  3. Martin Lormes
    Member

    The same problem exists with the Recent Comments Widget.

    I fixed it by changing the query in line 637 of wp-includes/default-widgets.php to the following:

    SELECT c.* FROM $wpdb->comments c
    JOIN $wpdb->posts p ON p.ID = c.comment_post_ID
    LEFT JOIN $wpdb->posts a ON a.ID = p.post_parent
    WHERE c.comment_approved = '1'
    AND ( p.post_status = 'publish' OR ( p.post_type = 'attachment' AND a .post_status = 'publish' ))
    
    ORDER BY comment_date_gmt DESC LIMIT 15

    Well, I didn't really edit the core. I copied the entire class WP_Widget_Recent_Comments to my theme's functions.php, renamed it and edited the query there.

    Posted: 4 years ago #
  4. Martin Lormes
    Member

    The Widget has a ticket now: http://core.trac.wordpress.org/ticket/12219

    Posted: 4 years ago #
  5. UncleZeiv
    Member

    12345

    Yep, confirmed Martin. And thank you for saving me the time to dig through the code to fix this...

    It just seems very strange that it seems that just a few of us care... I mean, comments in attachments! It seems to me a pretty prominent feature!

    Oh well... sorry for the rant :)

    Posted: 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    4 Votes
  • Status

    Good idea! We're working on it