• Hello,
    to cut a long story short — the category IDs on my site have all changed, how can I change them again?

    I want to change them back to what they were, and I have a list of the original IDs, but I don’t have a back up I can restore to, so I will need to edit something, somewhere, I’d guess.

    I have external scripts that interact with my site using the original category IDs, so it is important I get them back to what they were.

    I’m hoping there is a fairly simple solution…
    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • When you sayd ID, do you mean the database ID, or the slug of the category?

    If it’s the slug, that’s easily editable in the admin area.

    If it’s the database ID… you’ll need to do a whole lot of manaul editing directly in the database. So back up, and keep backing up… you will make mistakes (everyone does, it’s not easy) and see what you can do.

    Thread Starter phil2016

    (@phil2016)

    Thanks.

    To be honest, I didn’t realise there was more than one type.

    When I set up Gravity Forms on the site, I added the Cat IDs I found by hovering over the category links and finding the ID in the URL at the bottom left of my browser page. I don’t know which IDs those are but those are the ones used by Gravity Forms and some other scripts.

    Although it may be the other type of ID is also necessary to change — but I don’t know what the original ID is for any other kind.

    Any ideas?

    If it’s the numeric value (like 4, 56, etc) then that’s the database ID. The slug is the “human-readable” part that’s used in the URL’s.

    To be honest, the easy thing to do is go back and set up the new ID’s in Gravity Forms or any other systems that you’re using. In the long run that will be less painful then trying to re-do things any other way.

    Thread Starter phil2016

    (@phil2016)

    As I said in my first post — I need to know how to make the amendment myself.
    For many reasons (which aren’t worth outlining here, because there are too many) I will not be able to update all the various scripts we use, which use the original IDs.

    So, if anyone can please give me a link, or tell me, how to return the Cat ID’s to their original values, I would be very happy.

    Thanks.

    If you can’t do it yourself… be prepared for a world of pain.

    What you need to do is use a database management tool like phpMyAdmin. Most hosting accounts will have this set up. From there find the tables for the terms, and that is where it gets hard.

    There’s three tables that you have to be concerned about:

    1. wp_terms
    2. wp_term_relationships
    3. wp_term_taxonomy

    You can find the ID if the terms that you want to use and modify those to match what they should be. BUT… the very tricky part is that every entry that corresponds to that term in the other tables must be changed to the same ID as well. If there’s anything wrong things will crash.

    And to make it harder, there’s most likely other terms set up now that are using the ID’s that you want to use, so you will need to find out all of those first, and change those to something else, and then go back and change your original terms.

    It is very complicated and not something that I’d reocmmend anyone doing unless they really know what they are doing.

    Just remember – Keep backups! backup your database before you start. Back it up again after every successful change that you have, and keep these backups stored and labled correctly so you know which one is which.

    That’s pretty much it. There’s no easy way of doing what you want to do, so good luck. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How To Change Category ID ?’ is closed to new replies.