Title: Solution for 2.3 database errors / wp_post2cat does not exist
Last modified: August 18, 2016

---

# Solution for 2.3 database errors / wp_post2cat does not exist

 *  [Arne](https://wordpress.org/support/users/arnee/)
 * (@arnee)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/)
 * If you are getting a database error like this:
 * >  WordPress database error: [Table ‘wp_post2cat’ doesn’t exist]
   >  SELECT p2c.
   > category_id AS cat_id, COUNT(p2c.rel_id) AS numposts, UNIX_TIMESTAMP(max(posts.
   > post_date_gmt)) + ‘8’ AS last_post_date, UNIX_TIMESTAMP(max(posts.post_date_gmt))
   > AS last_post_date_gmt FROM wp_post2cat p2c INNER JOIN wp_posts posts ON p2c.
   > post_id=posts.id WHERE 1 = 1 AND posts.post_type = ‘post’ AND posts.post_status
   > = ‘publish’ AND posts.post_date_gmt <= ‘2007-09-19 12:08:25’ GROUP BY p2c.category_id
   > ORDER BY numposts DESC
 * or like this:
 * >  WordPress database error: [Table ‘wordpress.wp_post2cat’ doesn’t exist]
   >  SELECT
   > c.cat_name FROM wp_post2cat p2c INNER JOIN wp_categories c ON p2c.category_id
   > = c.cat_id WHERE p2c.post_id = 218
 * or like this:
 * >  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
 * or any other database error which contains **wp_post2cat** or **wp_categories**,
   you are using a plugin or theme which is not compatible with WordPress 2.3.
 * Example plugins which don’t work:
    - Google Sitemaps Generator older than 3.0 ([Download new version here](http://wordpress.org/extend/plugins/google-sitemap-generator/))
    - Posts by Author plugin
    - Ultimate Tag Warrior
 * It could also be that your theme is causing this error:
    - K2 Theme ([See this thread](http://wordpress.org/support/topic/135540?replies=11#post-620629))
 * Please double check before posting that you don’t use any incompatible plugins.
   A list of plugins that work and which won’t work can be found at [the WordPress Codex](http://codex.wordpress.org/Plugins/Plugin_Compatibility/2.3).

Viewing 15 replies - 46 through 60 (of 100 total)

[←](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/?output_format=md)
[1](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/?output_format=md)
[2](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/?output_format=md)
4 [5](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/5/?output_format=md)
[6](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/6/?output_format=md)
[7](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/7/?output_format=md)
[→](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/5/?output_format=md)

 *  [buzz](https://wordpress.org/support/users/buzz/)
 * (@buzz)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625164)
 * I had this error with no plugins activated. Turns out I had uploaded the wrong
   wp-config.php file.
 *  [americasroof](https://wordpress.org/support/users/americasroof/)
 * (@americasroof)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625169)
 * After considerable drama I used phamyadmin to add the table back (it was not 
   picky about field names or descriptions). That solved the problem.
 *  [Chris_K](https://wordpress.org/support/users/handysolo/)
 * (@handysolo)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625184)
 * > That solved the problem
 * Well, it “masked” the problem. It’ll be back to bite you unless you figure out
   which theme or plugin you’re using needs to be upgraded.
 *  [subwayblogger](https://wordpress.org/support/users/subwayblogger/)
 * (@subwayblogger)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625200)
 * **NOTICE** Google sitemap plugin does not automatically get flagged as needing
   to be upgraded. I had a pre 3.0 version, and the new plugin checker didnt know
   that there was a new one.
 * As soon as I upgraded to 3.0, everything worked like butter.
 *  [Keilya](https://wordpress.org/support/users/fantasycrusader/)
 * (@fantasycrusader)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625207)
 * > _joyce and fantasy.._
   > [http://wordpress.org/support/topic/135636?replies=5](http://wordpress.org/support/topic/135636?replies=5)
 * Much love and thanks. ^_^
 *  [Stephanie Leary](https://wordpress.org/support/users/sillybean/)
 * (@sillybean)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625227)
 * Otto42: well, that marks the first time [Transmit](http://www.panic.com/transmit/)
   has failed me on synchronization, but re-uploading wp-includes did indeed fix
   the problem. Thanks.
 *  [z1zzy](https://wordpress.org/support/users/z1zzy/)
 * (@z1zzy)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625245)
 * I updated with Dreamhost’s one click install, and now I’m getting this at the
   very top of my page, and also in the sidebar where the categories should be:
 *     ```
       WordPress database error: [Table 'megatonikwp1.wp_terms' doesn't exist]
       SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag') AND tr.object_id IN (313, 312, 309, 306, 303, 301, 299, 298, 296, 295, 294, 293, 291, 284, 283) ORDER BY t.name ASC
       ```
   
 * And this where categories should show up below posts:
 *     ```
       WordPress database error: [Table 'megatonikwp1.wp_terms' doesn't exist]
       SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (313) ORDER BY t.name ASC
       ```
   
 * Plus, all my categories got deleted, and I can’t add any new ones.
 * I really need to get this fixed…can any one help, and if possible tell me how
   I can make my theme compatible?
 *  [demodulated](https://wordpress.org/support/users/demodulated/)
 * (@demodulated)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625252)
 * Thank goodness I knew about the forums at wordpress.org. I was THIS CLOSE (holds
   fingers close together) to looking for a new blog platform after getting this
   database error after upgrading. Luckily the forums advised me to toggle my theme
   and plugins and I isolated the problem as an old Google Sitemaps plugin.
 * I was quite frustrated with the installation instructions. It’s a good thing 
   I’d upgraded so many times before so the absence in the quick install guide of
   a recommendation to make backups was conspicuous! Why are people not recommended
   to make backups?? Good thing I did!!!!
 * I’m also annoyed that the quick install guide didn’t advise me that some plugins
   are not compatible with WP2.3 so I had no idea that they could be the problem.
   Toggling plugins one by one revealed the issue and I was up and running in no
   time – after hours and hours of troubleshooting.
 * Great release but terrible documentation. The poor docs nearly made me ditch 
   WordPress forever. If I did this my first post would be advising everyone to 
   stay far away from WordPress.
 * For shame. This was a very common problem with a very easy solution, and if I
   didn’t think to look at the forums I never would have fixed it.
 *  [jacktan](https://wordpress.org/support/users/jacktan/)
 * (@jacktan)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625253)
 * erm, can someone please explain to me this in layman terms?
 * Ultimate Tag Warrior 3.14159265 Possibly incompatible: old category table.1
 * how do i fix it?
 *  [mdi](https://wordpress.org/support/users/mdi/)
 * (@mdi)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625254)
 * [@demodulated](https://wordpress.org/support/users/demodulated/)
 * maybe it’s because you »upgraded so many times« and because you’re such a pro,
   that you don’t read instructions… maybe it’s because you found WordPress somewhere
   else…
 * > We’ve got information on [installation](http://codex.wordpress.org/Installing_WordPress)
   > and [upgrading](http://codex.wordpress.org/Upgrading_WordPress) if you need
   > it.
 * >  Step 0: Before You Get Started
   >  * Just in case something goes wrong, it never hurts to have a backup. [We have extensive instructions](http://codex.wordpress.org/WordPress_Backups)
   > to help you out.
 * what else do you need?
 *  [magnetbox](https://wordpress.org/support/users/magnetbox/)
 * (@magnetbox)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625268)
 * Here’s how I fixed it.
 * Previous code:
 *     ```
       <?php
       	$query = "SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, category_count FROM $wpdb->categories ORDER BY cat_name";
       	$categories = $wpdb->get_results($query);
       	foreach ( $categories as $category ) {
       		echo("<div class=\"cat_num\">".intval($category->category_count)."</div><div class=\"cat_name\"><a href=\"".get_category_link($category->cat_ID)."\">".$category->category_nicename."</a></div>");
       	}
       	?>
       ```
   
 * New code:
 *     ```
       <?php
       	$query = "SELECT * FROM $wpdb->term_taxonomy JOIN $wpdb->terms ON ($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id) WHERE $wpdb->term_taxonomy.taxonomy = 'category' ";
       	$categories = $wpdb->get_results($query);
       	foreach ( $categories as $category ) {
       		echo("<div class=\"cat_num\">".intval($category->count)."</div><div class=\"cat_name\"><a href=\"".get_category_link($category->term_id)."\">".$category->name."</a></div>");
       	}
       	?>
       ```
   
 * Basically, instead of grabbing the fields from the categories table, you grab
   anything that’s a category in the taxonomy table and look up the title in the
   terms table. I’m sure there’s an even smarter or more proper way of doing it (
   such as using the relationships lookup table) but for my simple little category
   link list it did the trick.
 *  [Pinyin](https://wordpress.org/support/users/pinyin/)
 * (@pinyin)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625275)
 * I’m having similar woes. Here’s what I’ve been getting lots and lots of since
   upgrading to 2.3:
    — WordPress database error: [Table ‘py.wp_post2cat’ doesn’t
   exist] SELECT post_id, category_id FROM wp_post2cat WHERE post_id IN (***) — [
   I’ve substituted *** for the numbers that appear in parentheses, as they are 
   different in each post and appear to be the post number.]
 * I tried disabling all plugins. This made no difference. (I had only a few basic
   ones anyway.)
 * I tried changing from my own custom theme to other themes. The problem didn’t
   change. (The only thing I had altered in my own theme was the CSS. I don’t know
   enough about PHP to mess with that.)
 * Searches of my files didn’t turn up the code magnetbox posted, so I couldn’t 
   change that.
 * douglsmith’s Preflight plugin didn’t turn up anything in need of fixing.
 * What *does* improve things temporarily is if I run the database update script(
   wp-admin/upgrade.php). But, oddly enough, the fix doesn’t last; the problems 
   always return.
 * I’ve cleared the cache in my browser. I’ve tried different browsers (Opera, Firefox,
   IE). No difference.
 * In case it matters, this blog is hosted on Dreamhost. WordPress was installed
   through the Dreamhost panel and has been upgraded through that as well.
 * Any useful advice would be gratefully received. Thanks.
 *  [orasid](https://wordpress.org/support/users/orasid/)
 * (@orasid)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625282)
 * I deactivated Jerome Keyword’s Plugin. Popularity Contest latest plugin “works”
   now for 2.3
 *  [orasid](https://wordpress.org/support/users/orasid/)
 * (@orasid)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625283)
 * It’s kinda weird. If I activate Jerome Keyword’s Plugin, the infamous wp_post2cat
   complains however, on other pages such as archive, category, it didn’t show.
 * I just lost my tags. Sadness.
 *  [ginji](https://wordpress.org/support/users/ginji/)
 * (@ginji)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/#post-625294)
 * NS Recent Posts also shows the error.

Viewing 15 replies - 46 through 60 (of 100 total)

[←](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/?output_format=md)
[1](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/?output_format=md)
[2](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/?output_format=md)
4 [5](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/5/?output_format=md)
[6](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/6/?output_format=md)
[7](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/7/?output_format=md)
[→](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/5/?output_format=md)

The topic ‘Solution for 2.3 database errors / wp_post2cat does not exist’ is closed
to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [Database Error](https://wordpress.org/support/topic-tag/database-error/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 100 replies
 * 78 participants
 * Last reply from: [whooami](https://wordpress.org/support/users/whooami/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/7/#post-625524)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
