WordPress 2.3.x Upgrade Error: Tables wp_terms and wp_term_taxonomy Don’t Exist

While upgrading some outdated sites to the latest version of WordPress (currently 2.3.3), I ran across this error:
WordPress database error: [Table 'DB_NAME.wp_terms' doesn't exist]

When I ignored the error and continued to the admin panel, I noticed that there were no categories listed, and all the posts were set to the “uncategorized” category (though even this was not listed on the Manage -> Categories page).

The reason for this error is that WP 2.3.x does not use the wp_categories table; it uses wp_terms and wp_terms_taxonomy instead. The upgrade script is supposed to move the data from the former to the latter, but something was preventing it from doing so successfully.

A search of the WordPress codex revealed some important reminders, but no help:

  • Always back up your database before attempting an upgrade
  • Always disable all plugins before attempting an upgrade
  • Always revert to the default “Kubrick” theme before attempting an upgrade (because many themes now contain custom functions that can interfere with the upgrade process)

Fortunately, I’d done backups, as I always do. However, I must admit to being somewhat spoiled with WordPress upgrades, as this is the first significant difficulty I’ve ever encountered with an upgrade (other than incompatible template tags and plugins). This is a chilling reminder that, no matter how well things have gone in the past, doing a backup is NOT optional; it’s essential.

After trying everything I could think of, I recalled a forum post that suggested commenting out (or deleting) these two lines in the wp-config.php file:
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', 'utf8');

You can comment them out by preceding them with two forward slashes:
//define('DB_CHARSET', 'utf8');
//define('DB_COLLATE', 'utf8');

Certain earlier versions of WP shipped with these lines, though you may not have them at all.

I restored my database from the backup, used PHPMyAdmin to deactivate all the plugins and to set the theme to ‘default’, and ran the upgrade script again (by visiting mysite.tld/wp-admin).

This did it, and I was able to re-activate my plugins and theme. Problem solved.

Why Can’t I Edit My Theme? Using CHMOD to Set File Permissions

One of the questions we get most often is how to enable WordPress to edit theme files using the built-in theme editor. By default, when you upload a theme, the files aren’t writable from the WordPress interface. This is based on the sensible assumption that, generally speaking, visitors to your website shouldn’t be able to edit the files on it. If you’re the administrator of your WordPress site, though, it’s very useful to use the built-in theme editor.

To make your theme files writable, you need to set the permissions on the theme files so WordPress can edit them. This process is also known as CHMOD, short for CHange MODe, which is a UNIX/Linux command (which you probably don’t need to worry about).

To change the permissions of the files on your site, the way you’d open a folder on your computer, you need an FTP application, which is a separate program that connects to the web server to let you upload, download, move, or rename files.

You can download an FTP program such as the following:
Smart FTP
CuteFTP
FireFTP (a Firefox extension, which may be the easiest if you use the Firefox browser; will not work if you don’t)

After installing one of these programs or another FTP application (there are tons available for free), login to your site via FTP. You’ll need three pieces of information:
FTP server - probably ftp.yourdomainname.com
Username - probably the same as your account webhosting account username
Password -probably the same as your account webhosting account password

Note that the username and password will not ordinarily be the same as your WordPress username and password.

Your files are probably within a folder called public_html, httpdocs, html or something along those lines. From there, the themes will be in /wp-content/themes/, and each theme is in its own folder.

Navigate to the folder containing your theme. Then, highlight all of the files in this folder and right-click on them. There should be an option on the FTP program’s right-click (context) menu called “CHMOD” or “Permissions.”

The permissions settings specify what can be done with a file, and by whom. They’re represented by numbers or checkboxes that give read/write/execute permissions for each file to various groups, e.g. website visitors, you (the FTP user), or the server administrator.

If the files are set to 000, only the server administrator will be able to access them. By default, most files uploaded via FTP are set to 755 or something similar, which means that WordPress can run because anyone can “execute” the file (that is, access the script). However, since WordPress is not considered a user, it’s a member of the “public” group, so by default it can’t write to files.

If you set the theme files to 777 (so everyone has “write” permissions as well as read and execute permissions), that will let you edit your theme from within WordPress. If your FTP program uses checkboxes instead of numbers for file permissions, just check all of them. If you change themes later, just re-do this for the new theme’s files. You could do this for all your files without any problem, but it would take a while, and it’s not really necessary.

Note that if you make an edit to a file that introduces an error that takes down your site, you might need to upload a fresh copy of the theme via FTP, so it’s best not to edit PHP portions of your theme unless you have a backup of the theme file or are comfortable editing PHP. The functions.php file should not be edited from within WordPress, as an error can take down the WP admin panel as well as the public site, and you’d need to fix the error via FTP.

This procedure will work for plugins as well using the built-in plugin editor, but editing plugins is much more likely to crash WordPress, so we do not recommend using the plugin editor. Most plugins have an options page now, and don’t require any editing. if you need to edit a file, use a text editor on your computer and upload the changed file via FTP. If you get an error, simply delete the file, fix the error, and upload it again.

To summarize:

  1. Download and install an FTP application
  2. Login to your site via FTP
  3. Navigate to the theme folder
  4. Select all the files, and right-click on them, and select “Permissions” or “CHMOD”
  5. Check all of the boxes or set the permissions to 777
  6. Visit Presentation -> Theme Editor in WordPress to edit your theme files

Accented Characters in WP2.1 and MySQL 4.1

MySQL 4.1 has a bug that prevents WordPress 2.1 from displaying accented characters correctly. Instead, they appear as ? marks.

To fix this, open /wp-includes/wp-db.php
and look for this line:
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
(it’s around line 52).

Immediately after that line, add:
mysql_query("SET NAMES 'utf8'");

Save and re-upload the file, and you should see accented characters as usual.

Via

If you are a WebbleYou customer and require accented character support, please contact us and we will be happy to make the necessary changes. No alterations to the database are necessary.

 

Home | Blog | Blog Network

WebbleYou is not affiliated with WordPress, which is freely available under the GPL

Close
E-mail It