A few weeks ago I noticed a very strange bug with all of my wordpress plugins in the newest version of wordpress (2.7). All of the plugins can be used as widgets. When I tried to add one of plugin widgets to the sidebar, it seemed to be okay, but when I clicked on “save changes”, it would disappear. I then later discovered that it was sort of added. If I checked “show unused widgets”, then I would see my widget in the list, and if I tried to add it from here, the changes would stick.

A couple weeks ago I spent several hours trying to figure out what had changed in the widget handling code from wp 2.6 to 2.7, and decided to start from a wordpress default widget – the text widget, and see if I could get it to work, and then gradually change it to my plugin. I made some pretty good progress, but at the end I could not figure it out. I knew that I needed several hours of solid work to unravel the mystery, and with the holidays and moving across the country, I didn’t find the time until today.

But today I finally figured it out, and it actually only took me about an hour. It turns out I needed to change 3 bytes (characters). I happen to like mixed case, so many of my variables and such in my code look like “collapsArch”, or “collapsLink”. It turns out that the widget id in wp 2.7 will not allow mixed case. Or rather, it will exhibit the strange behavior I have been seeing. So changing “collapsArch” to “collapsarch” in 3 places in the widget handling code fixed the problem.

I have released updates to all 4 plugins today, along with a new debugging option, which should make it easier to solve possible problems. When the debug option is selected, some debugging information gets written to the page in a hidden <pre> environment. This way you can see what is going on by viewing the source, but most visitors will not notice the fact that you are debugging.