I mentioned on twitter that the blog was acting funny.
My blog is redirecting to the same post every time you go to the homepage. It’s a good post, but still. [opens the code hatch] I’ll be back.
When you visited the home page it would always redirect you to this post. While that post is a good piece of writing, it wasn’t the behavior I wanted or intended. I checked all the normal places:
* all the normal settings
* web host’s settings
I then checked the code on the server to make sure there wasn’t anything unusual but didn’t find anything.
Then I started disabling the plugins. I don’t use many, but figured it wouldn’t hurt. That didn’t help.
Which led me down many ratholes and a couple of lost hours.
After that, I walked away for a while.
Coming back to it I started thinking through the path that a request could make through the application. I don’t know wordpress specifically, but I understand the basic steps that a process would go through and realized that one of the plugins I had was la petite url. I had disabled it earlier, but maybe there was something else going on? Looking at it’s info page, I realized it hadn’t been updated in a while and isn’t compatible with the version of WP that I have. Looking at the database tables, I realized that it hadn’t been creating new urls for some of my new posts – starting with the post that everything was redirecting to! I hadn’t been publishing the short urls for a while so I just deleted the plugin. SOLVED!
Here’s what I think happens: The table itself was pretty simple. It just had two fields: postId and urlsnippet. I assume that la petite url intercepts the routing, looks for a matching url and returns the postID. Since the posturl was empty string, it’s always going to match the first time that had an empty url. The bug appears to be not checking for null.
It was a free plugin in a free product so I can’t complain too much, but I won’t be getting those hours back. In the positive, I learned much more about how wordpress operates.