Fixing blank category and tag pages in WordPress

Fixing blank category and tag pages in WordPress

Ahh… sometimes the smallest things can prove to me the most frustrating. After fighting with high CPU usage on my Bitnami install I decided to give W3 Total Cache another try. I installed the plugin, set it up, tested a few pages and everything seemed to be working. Even a bit speedier (yah!).

So I carried on browsing around my WordPress site and then I noticed that all my tag and category pages were blank. what?! I was almost confident that I saw them working just fine a few days ago. I thought the problem would be simple to fix – after all, I hadn’t really changed anything configuration-wise on my site for at least a week or two. And the one change I did make was easy to undo.

I was so right, and so wrong.

First I tried deactivating W3 Total Cache – seems obvious that the most recent thing would have caused the problem. Nope. I tried toggling the permalink settings in WordPress, and recreating my .htaccess file. Nothing, the pages were still blank. I remembered installing mod_pagespeed recently, so turned it off and restarted Apache. nothing.

Then I took a flyer – maybe saving a new AMI had caused some weirdness. I restarted the instance and the same friendly white page stared back at me. I restarted Apache again (you can never restart too much, right?) and ended up in the same place.

In desperation I turned to Google and found this WordPress help article on how to fix permalink problems in WordPress. Ahh, I’d have to brave a few more changes to httpd.conf. I changed my AllowOverride – still nothing – of course I knew this wasn’t the source of the problem because I had good evidence that the rewrite rules in .htaccess were getting picked up. I flirted with this advice for fixing custom permalink and trackback 404 issues, but decided against trying it – the symptoms were very different than mine, and I wasn’t thrilled with editing random .php files in my WordPress install.

A Solution! Blank category and tag pages in WordPress begone!

It was only through happenstance that I stumbled on the solution. I changed the permalink structure from ‘tag’ to ‘tags’ in WordPress, and it worked. ‘Hmmm’, I thought to myself, ‘ that doesn’t make any sense’. I changed it back and it stopped working. I changed the permalink for categories to ‘c’ and tags to ‘t’ – and resigned myself to the SEO hit I’d get from this. At least I’d get a shorter URL, right?

Then something strange happened. Categories worked, and tags loaded a weird page I’d used for testing a while back. Then it hit me!

I had category.php and tag.php files in my WordPress base directory. OMG! I remembered mistyping a copy command about a week back, and thinking nothing of it. This was the problem! I deleted those files, set category and tag redirects back as they were before and Viola! it worked.

So the solution was simple. Trivial. Yet not obvious until I stumbled across it.

That’s one of the reasons I love computers. They do just what you tell them to. Even when it’s not what you want them to do.