WordPress.org

Ready to get started?Download WordPress

Forums

Admin breaks if post or category ID == 0 (7 posts)

  1. theillustratedlife
    Member
    Posted 8 years ago #

    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.

  2. viitoria
    Member
    Posted 8 years ago #

    Yes, that's because IDs of 0 cannot exist...

  3. theillustratedlife
    Member
    Posted 8 years ago #

    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).

  4. viitoria
    Member
    Posted 8 years ago #

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

  5. Chris_K
    Member
    Posted 8 years ago #

    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"?

  6. theillustratedlife
    Member
    Posted 8 years ago #

    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!

  7. dahamsta
    Member
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic