You can add_filter()
the wp_nav_menu_items()
hook. It gives access to the html output of the list items with $items
.
Immediately after this hook is wp_nav_menu_{$menu->slug}_items()
hook that gives you access to the same but for a specific menu.
Info on add-filter()
if you need it.
The two wp_nav_menu_items
related hooks in context:
They are at lines 220 and 231 of wp-includes/nav-menu-template.php
From trac:
/**
211 * Filters the HTML list content for navigation menus.
212 *
213 * @since 3.0.0
214 *
215 * @see wp_nav_menu()
216 *
217 * @param string $items The HTML list content for the menu items.
218 * @param stdClass $args An object containing wp_nav_menu() arguments.
219 */
220 $items = apply_filters( 'wp_nav_menu_items', $items, $args );
221 /**
222 * Filters the HTML list content for a specific navigation menu.
223 *
224 * @since 3.0.0
225 *
226 * @see wp_nav_menu()
227 *
228 * @param string $items The HTML list content for the menu items.
229 * @param stdClass $args An object containing wp_nav_menu() arguments.
230 */
231 $items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args );