Code Web

How to fix your WordPress 2.0.1 feeds

If, like me, you waited to update your WordPress installation until 2.0.1 came out, you might have noticed that your article feed turned into a comment feed. Which, as we can see from the following picture, is rather detrimental to your visitor figures:

Hang on..why are my visitor stats dropping…? Oh right, the rss feed!

It’s worth noting this doesn’t happen to everyone – just to people who have index.php in front of their permalinks. The fix for this problem is included in 2.0.2, but it’s a bit silly to have to wait until it comes out. Luckily there’s an easy two-step solution to the problem:

1) As per the instructions at Trac Bug Ticket 2379 :

Open the file ‘classes.php’ in your wp-includes/ folder. Find line number 1321; it should look like this:

// Root
(blah blah)

// Comments
$comments_rewrite = $this->generate_rewrite_rules($this->root . $this->comments_base, true, true, true);
$comments_rewrite = apply_filters(‘comments_rewrite_rules’, $comments_rewrite);

That first line in the comments section (in bold) needs another ‘, false’ behind it. That means it should end up like so:

// Comments
$comments_rewrite = $this->generate_rewrite_rules($this->root . $this->comments_base, true, true, true, false);

2) Now go to your ‘Options’ panel in your WordPress admin centre. Click on the ‘permalinks’ tab. If you’ve chosen the 4th option, copy your custom structure to clipboard (ctrl+c). Select the 1st option. Click ‘update permalink structure’. Now select your original option again. If it the 4th, put your custom structure back in again. Click ‘update permalink structure’ again. Or, because an image speaks a thousand words:

How to fix your permalink issue to fix the rss feed

That’s all there is to it!

Update: WP 2.0.2 is out, and the fix is indeed included. Remember to use the special upgrade procedure – it’s a quick delete/move & upload this time!