I am using the following hook to loop over my menu items and apply a class based on certain criteria.
add_filter( 'nav_menu_css_class', 'highlight_base_category', 1, 3 );
nav_menu_css_class filter runs for each individual menu item, but I want to completely halt the filter once the class has been applied to one menu item, to prevent more than one menu item having the same class.
I've been looking at setting a global boolean, or using a session, but it seems messy.
Is there a way of breaking out of the filter for the entirety of the current page request, or a global flag i could set and check each time a menu item is filtered?