Is there a way to determine which theme placement a menu is for when modifying it with the wp_get_nav_menu_items
filter hook?
I’d like to only add items to certain menus and I don’t want to have to depend on the ID or the name of the menu.
Is there a way to determine which theme placement a menu is for when modifying it with the wp_get_nav_menu_items
filter hook?
I’d like to only add items to certain menus and I don’t want to have to depend on the ID or the name of the menu.
Comments are closed.
Not sure this is the simplest means, but you could conditionally add the filter to just the location you want to modify via
wp_nav_menu_args
filter whenwp_nav_menu
is called, then immediately remove the filter so it isn’t applied to other menus.