Update Theme Location Programatically
Generally speaking, you shouldn’t be (or need to be) “updating” the theme_location for a custom nav menu. The theme_location is the template location for a given nav menu. If you need to do dynamic manipulation of a custom nav menu, you might be better off targeting the id of the menu, rather than the theme_location. … Read more