How to get current-menu-item title as variable?
This is possible by filtering wp_nav_menu_objects, which is the easiest place to check which item is the current menu item, because WordPress already added the classes for you. add_filter( ‘wp_nav_menu_objects’, ‘wpse16243_wp_nav_menu_objects’ ); function wpse16243_wp_nav_menu_objects( $sorted_menu_items ) { foreach ( $sorted_menu_items as $menu_item ) { if ( $menu_item->current ) { $GLOBALS[‘wpse16243_title’] = $menu_item->title; break; } } … Read more