Does the menu item ID ever change?

WordPress menus are their own Post Type ( nav_menu_item ). Every time you add a new item to a menu it create a new “post” in the nav_menu_item post type and assigns it a new ID just as deleting and recreating a page removes / adds new ids.

This means the only way the Navigation Item ID will change is if the item is removed from the Menu. You’ll never have overlapping id‘s either. If that’s an issue then it’s not very reliable. A more suitable solution would be to use pseudo selectors such as:

  • :nth-of-type(n)
  • :first-child
  • :last-child

Some browsers may have trouble with Pseudo Selectors though ( old browsers ).