When registering a sidebar, you can use unique sidebar ID (must be all in lowercase, with no spaces), for example:

register_sidebar(array(
'name' => 'RightSideBar',
'id' => 'right-sidebar',
'description' => 'Widgets in this area will be shown on the right-hand side.'
));

when you switch your theme, if your new theme has same sidebar ID with your old theme, then your widgets for this sidebar ID will stay there… but, for different sidebar IDs, the old widgets will be moved to “Inactive Widgets” area. That’s the rule…

If you doesn’t add unique sidebar ID when registering your sidebar, then the ID for this sidebar will be “sidebar-1”, “sidebar-2”, “sidebar-3”...

ParkerAndKent said
In any case, by switching themes, you would lose all the custom widgets packed with the theme you’re deactivating.

This can only work with standard widgets or with the ones added by external plugins.

Parker

Are you sure about that ? Did you test the beta version?

I mean they should build a system to remember also the theme name, and his widgets stored in a database.

If you are true this will not help much because any theme will have his own widgets for sure.

Thanks.

Sure I’m sure… the code for custom widgets is within the theme, so if the theme isn’t installed how would you have those widgets able to be executed?

These new features of WP3 .3 can only take in consideration the basic WP features, not premium ones.

Thanks PK for the explanation.

This ruins all my plans with the theme I just wanted to release I didn’t think that detail from the beginning with loosing a theme widgets when activating another.

I must think for a new strategy.

Cheers.

Well, you can distribute a plugin with the theme specifically for the widgets. But, also in this case, if someone installs a theme with a different set of sidebars they would be moved to the inactive widgets default sidebar. This wouldn’t be that bad, because all the widgets would maintain their settings, but in any case they’d need to be then moved to the new sidebars.