//ad ID to li menu tag function menu_id_page($item, $args) { $page = get_post($args->object_id); $item = $page->post_name; return $item; } add_filter('nav_menu_item_id', 'menu_id_page', 10, 2);
// into any page or template <?php if ( has_nav_menu( 'main' ) ) { wp_nav_menu( array( 'container' => 'nav', 'container_class' => 'main-menu', 'items_wrap' => '<ul>%3$s</ul>', 'menu_id' => '', 'menu_class' => '', 'theme_location' => 'main' ) ); } ?>