I got an email from a professor who was using Gravity Forms to allow students to create blog posts. The problem was that when they submitted posts via the form the category ended up being the default category no matter what was selected. Here’s a few of the things I did trying to figure out what was going on. It’s just a matter of isolating variables but occasionally it’s helpful to see how people work through this sort of thing.
First, I googled it but that well was dry.1
I made sure the Gravity Forms category selection worked on other sites on the same installation. It did. That let me know it was at least blog dependent. There were only two other plugins active. They were both turned on and off with no change. That meant no plugin conflicts.
On the input side, I tried selecting multiple categories. No dice. I tried changing the default category. It change the default category but didn’t fix the issue. I couldn’t think of any more input based variables to mess with so I moved a bit deeper into things.
On the form side, I tried changing the category selection options. I tried using checkboxes, multiple select, all categories, select categories etc. None of that made any difference.
I copied the form to see if that would work. It didn’t. That let me know that any issue traveled with the form.
I then made a second form from scratch. That didn’t work- letting me know the problem was deeper than the individual form. I also made a third form with only two elements to see if somehow a particular combination of form elements caused the issue. It didn’t. All of this energy was focused on the Gravity Forms side of things.
Finally, I looked more closely at the categories themselves which is controlled in WordPress. This is something I should have done earlier. It turns out it was the way the categories were named that was the issue. The instructor had used colons in the categories. Colons appear to be poison.
This kind of pattern happens all the time. Look for simple variables to isolate (or eliminate) and then drill down. It’s tedious at times but it works pretty well. It’s not rocket science certainly but it helps to remain calm, to be boringly methodical and logical. Over time you pick up things that tend to work across environments and you can make some pretty decent intuitive moves based on previous experience. They’re also the same patterns of thought I have been applying lately to fix other things in my life- dishwasher, car, refrigerator, knee pain etc.
1 I’ll try to keep the language interesting.