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.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
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 ).