Support » Fixing WordPress » WordPress Upgrade – Categories Empty / blank

  • Resolved 749566

    I upgraded from version 2.1 to 2.6 today and everything went perfectly, that is until I checked my posts and noticed that all the categories were blank/empty!

    Just thought I’d share how I got round it so that others can resolve the issue without stress.

    Obviously before I began the upgrade I had done an export of all posts, pages, comments and categories. Also taken a database backup and followed the rest of the instructions on the upgrade page.

    Once I had upgraded and had the problem I had to do the following to restore my categories:

    1. Set up a test wordpress site with a clean 2.6 install (make sure you install to a new dbase!!).
    2. Import your wordpress posts, pages, comments, categories xml file that you exported earlier before the upgrade.
    3. Check that the new wordpress site contains your categories.
    4. open up php my admin (or use your prefered method to access MySQL) and navigate to the new site database.
    5. select the wp_terms table then click on export, leave SQL selected then press the go button.
    6. You are presented with a sql script. Copy just the section which has the “INSERT INTO” rows.
    7. Switch to your recently upgraded database and locate the wp_terms table.
    8. choose to empty the table.
    9. click on the sql tab for the table, then paste your text from step 6 and click on Go.
    10. You now have a table complete with your categories and the original ID’s!

    This method means you retain the original links between posts and categories and obviously saves you having to laboriously go through adding new tags and reassigning them to posts.

    I hope this post can help others in a similar predicament.

    Andrew

Viewing 15 replies - 1 through 15 (of 18 total)
  • I had the same problem. I manage to solve it by editing manually the wp_terms table of the upgraded database. In that table I added the category names and slugs to the corresponding term_ids. These data can be found on the sql file of the database backup under the line “INSERT INTO wp_categories (cat_ID, cat_name, category_nicename, category_description, category_parent, category_count, link_count, posts_private, links_private) VALUES”

    Panagiotis

    Okay…I’m not sure if I backed it up properly. I’m not a coder…have no idea how to access the MySQL or php my admin to look at the tables. I used a plugin that does the upgrading for me. It did a backup. I’ve looked all through the upgraded files and the old files and can’t find anything named “wp_terms”. Where is that? Do you have any idea how I’d change that file?

    Ok, nevermind. I figured out how to access php my admin. I was able to copy the code from the backup file, but unable to enter it into the table for some reason. How do I go about doing step 9?

    Nevermind, my problem doesn’t relate to this. (Sure wish there was an option to delete my post here.)

    Thread Starter 749566

    Hi elleepiphany2,

    you will need to be logged in to php MyAdmin with an account that has access to alter the database for wordpress.

    First you need to make sure the wp_terms table is empty by using the empty tab.

    Then using the sql tab, paste in the code and click on Go

    see this screenshot for how the window looks in php MyAdmin

    Also, the sql code you are placing back in should look something like this:

    INSERT INTO wp_terms VALUES (1, ‘Uncategorized’, ‘uncategorized’, 0);
    INSERT INTO wp_terms VALUES (2, ‘Blogroll’, ‘blogroll’, 0);

    This is where I enter the sql code similar to what you listed above.

    This is the error message I get after entering go, making no modifications to the default settings on the page.

    Do you know where I’m going wrong? Should I be entering this somewhere else?

    I can ENTER info when I export the file; but can’t save it, so it does me no good. When I enter the code anywhere else, I get an error message.

    I had the same problem. I manage to solve it by editing manually the wp_terms table of the upgraded database. In that table I added the category names and slugs to the corresponding term_ids. These data can be found on the sql file of the database backup under the line “INSERT INTO wp_categories (cat_ID, cat_name, category_nicename, category_description, category_parent, category_count, link_count, posts_private, links_private) VALUES”

    Panagiotis

    Can you be a little more specific! Please!

    Thread Starter 749566

    This is the error message I get after entering go, making no modifications to the default settings on the page.

    It is because you are trying to insert in to a different table….

    wp_terms is the table you need, but your insert into code shows wp_categories

    What the hell is WP thinking? I didn’t see any warning about this in the readme file, but this seems to be very common and a HUGE bug–at the very LEAST, they should add the warning that one should make special note of the category names. I backed up my databases and all the files, but this will be a MASSIVE pain in the ass to fix.

    Thanks for nothing, WP.

    It also occurs to me that if forewarned, people could probably avoid this pain in the *ss. I would guess that people making incremental upgrades, on a point-by-point release schedule, did not have this problem–only those going from 2.2 or lower up to 2.6 got slimed. Which means that one of the upgrades was transitional–a 2.1 or 2.2 user could upgrade to the transitional version (for example, it might be 2.4), and then upgrade from there to 2.6 WITHOUT losing all their category data. I probably just wasted two and a half hours of my life tediously re-inputting 52 categories and the associated data, when the clowns at WP could have simply made the transitional upgrade available and saved me most of that time.

    blogd: chill. you should have had a backup and just reverted to it until things got fixed.

    @all:
    I just wanted to report a slight difference in my experience. In my terms table, I had the names blanks and the slugs set to things like ‘-2-2-2-2-2-2-2-2-2’. I had to fix up that table and my term taxonomy table.

    I agree, pain in the rear – that hopefully is corrected in future updates.

    I can confirm this problem going from version 2.5.1 to 2.6. After the upgrade, all of my category names were truncated to a shorter version and I had to restore them all from a backup. D:

    For the record, I too had my categories disappear on me. I upgraded from 2.0.2 to 2.6. I managed to insert them manually as I didn’t have too many (by creating a dummy db and importing the SQL I’d backed up to access the category names and slugs). It’s the first time I’ve been disappointed with a WordPress upgrade.

    I looked at other messages like this and they recommended doing a restore of your database then upgrading it by increments.

    I did not want to mess with that, plus didn’t feel like messing with my host, so I did what this said:

    http://blog.cumps.be/wordpress-26-upgrade-fix-missing-categories/

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘WordPress Upgrade – Categories Empty / blank’ is closed to new replies.