Does the ID WordPress gives each menu item ever change?
id="menu-item-1234"
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.
Does the ID WordPress gives each menu item ever change?
id="menu-item-1234"
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.
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:
Some browsers may have trouble with Pseudo Selectors though ( old browsers ).