Please don’t put too much time into this, particularly if it is a general WordPress issue, but since you wrote this particular plugin I’ll bet you know an answer even if it is not good news.
When I add or remove a widget area, either with a plugin like yours or by registering or removing one myself in PHP, the relationship between widget areas and the widgets currently assigned to them is not maintained. The guess is that instead of a property list that stores the widget area’s id as a key and the widget id and values as the data which can then be used as an array at run time WP must just be storing a linear list of widgets in use and applies it to the number of widget areas available, starting from the top.
It is just like the kids game Musical Chairs. This happens in a huge way when I add or remove a structure from this plugin of course. Lots of nested widget action.
So am I missing a step when I add my widget area registrations in functions.php? Or am I using WP wrong? Is there a quick fix if WP is just that way?
I will say that the one time I have seen the problem before is when switching back and forth between themes. When you make the switch the more complex theme will lose its layout on return. That is why I don’t think it is my code or yours that causes the issue.
- The topic ‘Losing relationship between widget areas and selected widgets’ is closed to new replies.