Support » Fixing WordPress » Changing category ID problem

  • Resolved ronchicago


    i changed my category id’s in my database via phpmyadmin. those categories that have a parent are not appearing in my admin area. i can see the post on the browser and everything is fine in the db. i can add new children with no problem. but if i change even the new children’s id they disappear in admin. thoughts ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • let’s start with what i can / cannot do. can i have two category names that are the same ? but the slug and ID would be different.

    note: my original post needs clarifying. i can see the posts in the browser but they have lost their category tag.

    well, i found this. is it the latest and the greatest ?

    i have… 90-some categories already up on my db with five pairs of same name categories. and it’s a new edition of a blog with only ten posts.

    i am prepared to delete all my categories. publish 90-some test posts. and rename categories after the fact.

    going to make lunch now and hoping someone has successfully crossed this bridge before i get back…

    The issue that i think you may be having is that when you change the ID you need to do it in several places.

    The terms table, the term relationship table, and the term taxonomy table..

    The relationship table is what links posts to given categories, that would be the problem area regarding posts missing category tags at a guess.

    i deleted posts, categories, tags. relationships was indecipherable but then again there are no posts. created 6 new categories, three are children to one. went into terms and taxonomy and changed id’s on all. all categories are now visible in the post admin but the parent of the three is a no-show. and of course the three kids have no parent. this is now a realty show.

    i think i might just install a new db… is there anything else before i do this ?

    You also need to update the “default_category” option with a valid ID, as this will no doubt point at an older (perhaps non-existant) ID to..

    Options table if i remember correctly..

    here’s where we’re…

    ah! to your above comment. good to know! to continue.

    after deleting all posts i added two. i tried every combination of doing categories first then post, vice versa, blah blah. after talking to a db expert who is worried that changing things back and forth like this is dangerous because down the road when upgrades occur you never know if the relationships are corrupted. since there is so little on the site best practice is… a new db and have created a list of all categories, id #, slugs, etc., because…you never know.

    also what was learned in this process… it seems that it is ok to have two categories with the same name ( contrary to what i have found in the codex to date ) as long as the slug is different. it helps if the slug has the name of the parent in it ( in some instances wp is doing that on its own ) though i don’t know if that is a technical requirement for the db to function or just for an easy to trouble shoot thingy. thinking it is the latter.

    Well it’s certainly viable to make small changes directly via the DB if you need to make some custom adjustments, like your friend said, it’s important relational data is adjusted to.

    Generally it’s much safer if you let WordPress do it for you, so it will keep relational data intact and accurate.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Changing category ID problem’ is closed to new replies.