Support » Fixing WordPress » WP 2.7 Page ID Counter is out of sync.

  • There have been totally 70 pages on my blog and the last page ID was 70 before upgrading to WP 2.7. I’ve just created a new page today and WP has assigned ID 133 to this new page. Has anyone encountered this issue?

    Here is one of the bugs that I’ve logged against WP 2.7.

    I’ve found multiple issues since upgraded to 2.7 a couple days ago. I have been logging bugs since I have upgraded to it. I wish that I didn’t upgrade to 2.7. Is it possible to go back to 2.2 from 2.7?

    There is another bug that someone else logged and I have experienced the issue as well:


Viewing 6 replies - 1 through 6 (of 6 total)
  • Does it matter? If you delete a post and add a new post after that, the ID will be skipped as well.

    Going back to 2.2 requires your restore your 2.2 backup (after DROPping the 2.7 tables) and restoring your 2.2 files (after deleting your current files).

    Revisions and attachments take post ID numbers and as GamerZ said, deleting a post will cause the problem.

    I’d recommend sticking with 2.7 and trying to live with the ID number issue.

    There is a plugin call Reveal Post IDs you may want to look at:

    You can also use to not have revisions so it doesn’t use IDs, but again, attachments do use IDs.

    PS I think I’ve told you some of this before 😉

    Thanks guys for your replies.

    “Does it matter? If you delete a post and add a new post after that, the ID will be skipped as well.”

    Yes it does matter to me. I had no plan to delete any page ids or post ids. It just doesn’t make sense when you have 70 pages when WP 2.7 thinks that you have 133 pages.

    When WordPress messes up the counter for page or post ids, I can’t help wondering what other components are going to be messed up by it. I may not be able to find my existing pages one day if the basics don’t even work correctly ;-). All I have been doing is logging bugs and figuring out the issues generated by WP 2.7 since I’ve upgraded to it a few days ago.

    How could they even release such a buggy software 2.7 ???

    No thanks, no WP 2.7 for me!

    I have already figured out how to go back on WP 2.2. untar the tar file for the file system as well as for the database. I will upgrade to future WP releases after they do in depth testing and adding back the Page ID information in the Page Edit in Site Admin.


    Perhaps you can explain why it does matter to you? It is just a way to identify post.

    ANY web software you used will not have sequential ID as times goes by or I have not come across one yet.

    And lastly THIS IS NOT A BUG. If WP AutoSave a post, it will create an ID as well and hence the next post you published, the ID will be skipped as well.

    GamerZ and MichaelH,

    “As for the page counter, Thats correct. The ID’s are used by posts, pages, revisions, and attachments, so you’ll never get 1, 2, 3, 4….10000 unless you only create pages and disable revisions.”

    You are blindly defending WP 2.7 having the Page and Post ID counter issues. Please take a look at the existing bug

    The user has specifically pointed out the cause of the problem by the SQL statement, which is missing some key Where Clause conditions. That is a true bug just like what I had said in the first place.

    The reason that I’ve got 133 pages rather than 70 is the incorrect SQL statement in your WP 2.7 code.

    select count(*) from wp_posts where post_type = ‘post’ ;

    Thanks to mlebkowski, the correct SQL statement is the following:

    select count(*) from wp_posts where post_type = ‘post’ and post_parent = 0
    -> and post_status != ‘inherit’ — there are two posts with inherit status… dunno
    -> ;

    This is simply a bug if you understand the SQL statements.

    That is post count, what is it has to do with post id?

    Post with Inherit status also takes up 1 ID in the post database, so your post will not be sequential.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WP 2.7 Page ID Counter is out of sync.’ is closed to new replies.