Support » Fixing WordPress » HOW TO: Change Category ID’s in WordPress 2.7

  • I recently needed to change my category ID’s in WP 2.7 to make sure my MIMBO theme using VIVA Thumbs plug-in chose the right default category image if 2 categories were added to a post, as it chooses the one with the lowest number.

    Seeing as I have no MYSQL knowledge it is remarkably simple – here’s how.

    1. Make a full backup of your database in case something goes wrong. I use – This Wordress Database Backup plug-in.

    2. Write down all your categories and their current ID’s. You can find them out by going to the category section of your WordPress Dashboard and hovering over the category names. The ID will appear in the bottom of the browser window.

    3. Access your database with phpmyadmin.

    4. Select the wp_terms table and locate the Categories by their term_id number.

    5. Click the pencil icon and change each term_id value to the desired number. Choose high numbers to avoid clashing with other ID’s for tags or link categories etc. I choose 1010, 1020, etc.

    6. Then select the wp_term_taxonomy table.

    7. Go through this database and locate the entries with the OLD term_id values of your categories and edit them to read the same as the term_id values you just entered in the previous step.

    8. You are now done. All your posts associated with those categories should still be so.

    9. You will now need to go through your template and replace any category specific codes.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thanks so much for the walk-through!

    It’s exactly right.


    Do you know how to change Page IDs? Would it be the same process?

    I’m doing something wrong because get_categories seems to be returning results in the order of term_taxonomy_id rather than term_id. Any ideas what I could be doing wrong?

    I’m using 2.7.1 and verified that, with just two categories, get_categories() does not respect a renumbering such as

    100 -> 102
    101 -> 101

    Instead it seems to insist on alphabetic ordering even with order_by=ID too.

    woops, was using order_by rather than orderby



    you can also download the [GWA] db Editor plugin and access the database directly in the wp-admin.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘HOW TO: Change Category ID’s in WordPress 2.7’ is closed to new replies.