Written by nitinpai on January 2nd, 2008
WordPress Database Error – Table ‘wp_post2cat’ doesn’t exist
I recently upgraded my hosted WordPress from version 2.2 to 2.3.1. The upgradation process went smoothly but something strange happened when I tried to log into the administration dashboard. When I logged in, the page showed me a message stating that my database was old and I needed to upgrade it. I did as it suggested and the dashboard came into picture as usual. All till this point seemed fine, until I did the following things:
- Tried to add a new category
- Tried to edit a post
- Tried to comment from the blog post page
When I tried to do the above things I was shown a big fat error message which cried out,
WordPress database error: [Table ‘wordpress.wp_post2cat’ doesn’t exist]
SELECT cat_ID AS ID, MAX(post_modified) AS last_mod FROM wp_posts p LEFT JOIN wp_post2cat pc ON p.ID = pc.post_id LEFT JOIN wp_categories c ON pc.category_id = c.cat_ID WHERE post_status = ‘publish’ GROUP BY cat_ID
I managed to resolve this error in some time but those few moments were somewhat shocking. If you are getting the same error, the solution is quite easy. At first the error looks as something has gone wrong with your database but believe me, your database is fine. The problem maker are the plugins. The main cause of the above error are the following plugins:
- Google Sitemaps Generator
- Posts by Author plugin
- Ultimate Tag Warrior
- Similar Posts
Just disable these plugins and you should see your error disappear. You can later put in the latest versions of the above plugins and activate them. The Ultimate Tag Warrior plugin should not be required in my opinion since WordPress 2.3 + has the feature of tagging a particular post.
Always remember, before upgrading a WordPress to a newer version make a double check on the compatibility of the plugins you have already installed. The guys at WordPress have made out jobs much more easier by putting an alphabetically sorted list of compatible plugins with WordPress 2.3.
So when you install a plugin for WordPress in future do the following:
- Download it from the official WordPress plugin repository
- Check the version of WordPress till which the plugin is compatible with
- Backup your blog through WordPress Export feature before trying out a plugin.
Sometimes if you have self coded the theme, the error might not disappear because you might have used some tables like “wp_post2cat” which has been discarded in the newer version. So if your error is still not resolved try using the default theme (Kubrick) and then work your way out.