2

I thought Wordpress post IDs were only unique within each post type, so that the first instance of each post type would have an ID of 1 and they would count up from there. In order to get a specific instance of a custom post type, you would have to designate that post type in the query.

But according to this answer on another question, post IDs are actually unique to each post, regardless of post type. I checked in the posts table for the site I'm working on now, and sure enough the post IDs are unique. But I'm sure I read somewhere (a couple years ago) that they weren't.

Did Wordpress change the way it sets post IDs, or have I just been wrong this whole time?

1
  • They've been unique as long as i can remember, it's entirely possible whatever you read was either incorrect or the person that wrote it was confusing post IDs with something else(ie. made a mistake).
    – t31os
    May 1, 2013 at 15:39

1 Answer 1

4

All post types are stored in the same posts table, so they have to use different post IDs. That was always the case, since the the post type page was introduced 2005 with version 1.5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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