How to set WordPress Menus to Theme Locations

If you offer sample content which is usually an XML file, for your WordPress theme, there is always a problem of either menu missing or theme menu using fallback method.

This can result in multiple supports tickets. The solution would be to automatically assign menu to theme menu location on after_setup_theme hook or on import_end hook.

Here is an example code which you can use to programmatically assign your registered menus to registered menu theme locations.

2 thoughts on “How to set WordPress Menus to Theme Locations”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>