Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

With regards the menu item id's WP generates such as menu-item-814, are these 100% unique in nature?

I know they are unique at the time, but are they always unique? Meaning that if I was to delete something that had the id of 814, is it possible that some other menu item could now be assigned this ID? ...or if WordPress was updated do they still keep the same ID's?

I ask because I want to assign something to a certain menu button via JavaScript but on the off chance the button is removed I don't want to be applied to a new button that has now been assigned that ID.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Yes it is always unique. id 814 cant be applied again unless you update it manually on your DB. Its because of auto increment .. DB automatically increment id so everytime next id will be +1

814

815

816

and so on.. Even if you delete an id in between. It wont affect auto incrementation.

Read MY SQL AUTO_INCREMENT for detailed understanding.

share|improve this answer
    
Yep, know how auto increment works, just wasn't sure if that was what WP used for this. Thanks! –  Brett Sep 17 '12 at 18:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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