A fix for WordPress gallery comments not showing up in comments RSS feed

This won’t be of a huge interest to a lot of people, but it took me a while to find an answer, so hopefully this will save someone else a little time.

WordPress has a very nice built-in photo gallery feature where each thumbnail in a gallery automatically links to a dynamic page for that image, allowing visitors to comment on the photo.

Unfortunately, there’s been a bug in this feature ever since it was first introduced. Comments made on these dynamic gallery pages don’t show up in the site’s comment rss feed. The feed ignores them completely.

For whatever reason, the folks behind WordPress haven’t seen this as a high priority issue, so it’s never been fixed. I’m currently working on a personal project (more on that later), that would really benefit from these comments showing up in the comment rss feed like they should. Fortunately, after a fair amount of digging I found the answer in this comment in the WordPress Forums.

To force gallery-page comments to show up the standard WordPress comments rss feed, simply add the following code to your theme’s functions.php file:

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

add_filter('comment_feed_where', 'fix_comments_rss_attachments');

Or, if you would rather not edit your functions file, I’ve dropped this code into a handy WordPress plugin:

  1. Download the plugin
  2. Unzip the file
  3. Upload “gallery-comments-rssfeed-fixer.php” to your Plugins folder and activate it. There’s no configuration options – it just works.

Leave a Comment