$locations );
}
?>
This code creates a navigation menu with a single item, ‘Home’, and assigns it to the primary location. It first checks if the menu exists, and if not, creates it using the wp_create_nav_menu() function. It then adds the ‘Home’ menu item using wp_update_nav_menu_item(), and assigns it to the primary location using get_theme_mod() and set_theme_mod().
Was this code snippet helpful?
YesNo