How do I programatically insert a new menu item?
Before being printed, all the menu items get run through a filter. You can target the wp_nav_menu_items filter to tack things on to the menu: // Filter wp_nav_menu() to add additional links and other output function new_nav_menu_items($items) { $homelink = ‘<li class=”home”><a href=”‘ . home_url( “https://wordpress.stackexchange.com/” ) . ‘”>’ . __(‘Home’) . ‘</a></li>’; // add … Read more