Does the ID Wordpress gives each menu item ever change?


I've linked to it within my CSS, however this will be no use if this ID may change, for instance when the page is updated.

1 Answer 1


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 ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.