WordPress – Unavailable Widget Control in Admin Panel – Problem

I ran into a serious problem tonight, a recent change that was made to a clients site caused a traffic lose and so they restored the site back to a previous database and theme. When you change the theme with the widgets enabled there is a chance you will not gain access to the sidebar widget control from the WordPress Dashboard.

So not knowing how to get the sidebars back under control from the dashboard. I dove into the database to figure out how the active widgets are stored in the database. It didn’t take long for me to find that the Options Table has a record for all of the widgets and which ones are active and which sidebar they belong to.

Record number 82 in the Options Table is where this data is stored in my database. Here is an image of that record:

wordpress options table widget record

Once I found the record I clicked on the pencil to edit that record. In there I found all the data I needed to disable the widgets I needed. Here is the data that was in the options_value field of record 82.

a:4:s:19:”wp_inactive_widgets”;a:9:{i:0;s:7:”pages-2″;i:1;s:10:”calendar-2″;i:2;s:10:”archives-2″;i:3;s:7:”links-2″;i:4;s:6:”meta-2″;i:5;s:6:”text-2″;i:6;s:17:”recent-comments-2″;i:7;s:5:”rss-2″;i:8;s:11:”tag_cloud-2″;}s:9:”sidebar-1″;a:2:{i:0;s:20:”categories-436616501″;i:1;s:14:”recent-posts-2″;}s:9:”sidebar-2″;a:2:{i:0;s:11:”adsense-ad2″;i:1;s:11:”adsense-ad1″;}s:13:”array_version”;i:3;}

The registered sidebars are identified by sidebar-1 and sidebar-2. Immediately following the sidebar identifier is an a:2 for both of my sidebars. The number 2 identifies how many widgets are in that sidebar. The widgets that are in the sidebar are contained between the {}, brackets.

So to remove all of the widgets make the widget count to 0 and remove all data between the {}, brackets:
“sidebar-1”;a:0:{}

To remove only one widget from the sidebar, reduce the widget count by 1 and remove all of the data for the preceding i all the way to the ;
“sidebar-1″;a:1:{i:1;s:14:”recent-posts-2″;}
*notice I changed the widget count from 2 to a 1 and I removed the categories widget from inside the brackets

The complete code for the options_value field with no active widgets for both registered sidebars would look like this:

a:4:{s:19:”wp_inactive_widgets”;a:9:{i:0;s:7:”pages-2″;i:1;s:10:”calendar-2″;i:2;s:10:”archives-2″;i:3;s:7:”links-2″;i:4;s:6:”meta-2″;i:5;s:6:”text-2″;i:6;s:17:”recent-comments-2″;i:7;s:5:”rss-2″;i:8;s:11:”tag_cloud-2″;}s:9:“sidebar-1”;a:0:{}s:9:“sidebar-2”;a:0:{}s:13:”array_version”;i:3;}

I made some mistakes when editing the data in this record and when I did so. WordPress created a new sidebars_widgets record. This will cause you to not see any further changes to the original record. You will need to navigate to the last record in the options table and remove the new sidebars_widgets record then make the proper corrections to the original record.

The problem with the Admin Control of the widgets is not resolved at the moment. And the solution is unknown. All I was able to do for my client was remove the unwanted widget which surfaced this problem in the first place. I now have a better understanding of how the widget control is stored in the database and I hope to sort this issue out soon.

Look for a future post on the resolution of this problem or drop me a line if you have any info or feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *