On my new WP project, I have custom menus on different pages. I have main menu (Appearance -> Menus) and the pages of this menu have their own custom menus. I use code from this theme:
<?php wp_nav_menu( array( 'container' => 'none', 'container_class' => 'menu-header', 'theme_location' => 'primary', 'menu' => get_post_meta( $post->ID, 'MenuName', true) ) ); ?>
Everything works fine with this code.
When I chose some page from main menu, I know which is the current_page_item and can make proper styling. But when I chose some page from custom menu the main menu item is no longer with proper styling. How can I set current_page_item for main menu item, when I navigate through custom menu belonging to this main menu item ?