Register new widget position moves existing widgets
===

This is a general Wordpress issue I've dealt with on a number of occasions, I can't seem to find a good way to solve it. 

Basically exactly as the title says.  You've got a load of widget positions registered and those positions all contain widgets. You register a new widget position and when you check the backend the new position has been registered fine but Wordpress has lost track of which widgets are meant to go where and they are all in the wrong place. You have to drag and drop to reorder them again.  

Not a major headache but a bit of a pain if the client can dynamically create a widget position by adding a new page.  To give an example;

In functions.php I register a new widget container for each page in the site;

	$sitepages = get_pages();
	foreach ($sitepages as $pagesitem) {
			register_sidebar(array(
			'ID' => 'sidebar',
			'name'=>get_the_title($pagesitem->ID),
			'before_widget' => '<div class="sidebox">',
			'after_widget' => '</div>',
			'before_title' => '<h3>',
			'after_title' => '</h3>'
			));	
	}	

And then the widget gets called in the sidebar like so;

			<?php
				$pagetitle = get_the_title($post->ID);
				if (function_exists('dynamic_sidebar') && dynamic_sidebar("$pagetitle")) : else : 
					// Our page specific widgets load in here.
				endif;
			?>
 
All works great, except the creation of a new page 're-organises' everything.  Maybe I'm being thick (it happens!) any help much appreciated.