A site is using "child1" named child theme. When this site switches to other child theme named "child2", their widgets are moving too but theme locations are not moving. How can i auto assign menus to theme locations on theme activation?
I found this solution from http://wordpress.org/support/topic/how-to-assign-a-wordpress-3-menu-to-primary-location-programmatically
$theme = get_current_theme(); $mods = get_option("mods_$theme"); $key = key($mods['nav_menu_locations']); $mods['nav_menu_locations'][$key] = $menu_id; update_option("mods_$theme", $mods);
Is there any better wordpress way to fix this? (Related trac topic: http://core.trac.wordpress.org/ticket/18720 )