Well this is a new one… I was just prepping some sidebar widgets when I noticed that the very useful Text Widget was hiding its Title and text area fields when dropping it into a sidebar area. Clicking the Save button made the fields reappear, but saving the widget didn’t actually save the information. No widget appears on the site.
What on Earth was causing that? :-O
Knowing that these kinds of bizarro things can occur when pasting code into your functions.php file, that’s exactly where I started. I started ripping out things I had pasted recently until I got to the very last item. I removed it and sure enough, it fixed the problem.
But wait, there’s more.
It wasn’t actually the function that was causing the trouble. I actually pasted the code back in there and edited it to see if I could determine exactly what it was doing that would impact widgets. I hacked away at it until there was nothing left, yet it continued to mess with the widgets. How can that be? I totally removed it in the first place and that fixed the problem, but removing it piece by piece, the problem remained. Hum…
It turns out that when pasting the code into functions.php, two little characters came with it at the very end, which I did NOT remove. I did not remove them because I didn’t realize I had pasted them. How can that be? Because they were the closing characters for a stand-alone PHP statement…
?>
The PHP document didn’t mind those… but WordPress sure does! ;) If your widgets suddenly decide to go MIA, you might want to see if you don’t have those two characters at the very end of your functions.php file. If so, just delete them and you should be back in business.