• I just moved to a new host. I restored my mySQL there and adjusted wp-config accordingly. I also upgraded to rev. 2.0.3 from 1.5.2 in the process. I made a new category and a new post, both of which had an ID of 0. This completely broke the Edit Post page on the backend. Making these into positive numbers fixed the problem.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Yes, that’s because IDs of 0 cannot exist…

    Thread Starter theillustratedlife

    (@theillustratedlife)

    Right, but it seems like WordPress should handle this (either by not creating a post with an ID of 0 or by automatically updating the ID of any post it finds that is 0).

    Yes, and that’s what it usually does. Is it working non (without manual adjustments?)

    Pretty sure WP assumes that it has a “working” mysql database. Those keys are auto-generated.

    If you look at the table properties for the restored db, are those ID columns defined as “auto_increment”?

    Thread Starter theillustratedlife

    (@theillustratedlife)

    actually, posts and comments both had auto incrementation set to no. I just changed it. Hopefully it will work now. =)

    Is there some sort of catchall we can add to the code?

    on(saveToDB){
    if (ID.auto_increment == false)
    ID.auto_increment = true;

    I realize that isn’t in PHP, but could we do something like it?

    Thanks!

    I’ve experienced this behaviour after a migration too — auto_increment needed to be enabled on two tables post migration (different MySQL versions, if that’s relevant, although the dump was 323 compatible), followed by a new post being entered as id=0 and buggering up the Page Management view, plus that post. Stupid bug.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Admin breaks if post or category ID == 0’ is closed to new replies.