The right 3 bytes
OR
wordpress plugin bugs solved

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.

Join 165 other subscribers

archives

  • 2024 (10)
  • 2023 (8)
  • 2022 (15)
  • 2021 (19)
  • 2020 (1)
  • 2019 (1)
  • 2018 (2)
  • 2017 (1)
  • 2016 (2)
  • 2015 (5)
  • 2014 (5)
  • 2013 (2)
  • 2011 (7)
  • 2010 (10)
  • 2009 (50)
  • 2008 (28)
  • 2007 (31)
  • 2006 (8)

Category