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 - 31 through 45 (of 100 total)

[←](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/2/?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 [4](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/?output_format=md)
[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/4/?output_format=md)

 *  [punkoblog](https://wordpress.org/support/users/punkoblog/)
 * (@punkoblog)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625085)
 * I am getting this error. However, I am now unable to deactivate any plugins from
   admin. AND, I am unable to delete any of the plugin folders, or even the Plugins
   folder from my server now. When I try I get an error saying I do not have the
   permissions. Wow, I am stupified.
 *  [joyced](https://wordpress.org/support/users/joyced/)
 * (@joyced)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625087)
 * I found out that Custom Query String is causing my wp_categories errors. I’d 
   really like to continue using it but Matt Read no longer supports it. Would anyone
   know what to change to make it work with 2.3?
 *  [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/3/#post-625091)
 * > _I found out that Custom Query String is causing my wp\_categories errors. 
   > I’d really like to continue using it but Matt Read no longer supports it. Would
   > anyone know what to change to make it work with 2.3?
 * I really liked that plugin thing…really nifty. I’m still running it though. Just
   that you are not able to specify the arrangement of posts within specific categories.
   However you can still give general rules to all the categories and archives as
   a whole in general.
 * Of course if anyone do have a substitute for this plugin, do post it!
 * Lastly, I’ve done some searching around the plugin database. There seems to be
   some plugins similar to this. Where it allows you to arrange by alphabatical 
   order. Another one was even more specific, allowing you to order the exact sequence
   of the posts. But I found it to be not what I needed as it’s far too specific,
   tedious and requires too much input on my part. Anything close to Matt Read’s
   Custom Query String is much appreciated!
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625095)
 * joyce and fantasy..
 * [http://wordpress.org/support/topic/135636?replies=5](http://wordpress.org/support/topic/135636?replies=5)
 *  [lynnlovestennis](https://wordpress.org/support/users/lynnlovestennis/)
 * (@lynnlovestennis)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625097)
 * This could not get any better. I was forced to upgrade from 2.2 to 2.3 yesterday
   after HostGator decided to randomly shut down my site for abuse claiming that
   I was producing SQL queries (ie, server load) that they could not explain.
 * I’ve been getting the “‘wp_categories’ doesn’t exist” message since the upgrade.
 * In trying to ascertain what plugin, if any, was causing the problem, I tried 
   out the groovey new ‘categories to tags’ function, which then deleted all my 
   categories — save, of course, for the default one.
 * So now I have table errors as well as no categories.
 * How exciting! Can it get better?
 *  [betobeto](https://wordpress.org/support/users/betobeto/)
 * (@betobeto)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625098)
 * Hi all,
 * I’ve been using a customized version of the Yet Another Photoblog plugin, which
   has also been hit by the 2.3 post2cat gotcha. The author’s forum is regrettably
   having problems at this moment so I’m giving this place a try. 🙂
 * As part of my customizations I’ve got a Query variable that looks like this (
   and I’m sure is what is causing the choking at this time):
 * `$query = "SELECT p.* FROM $wpdb->post2cat p2c LEFT JOIN $wpdb->posts p ON p2c.
   post_id = p.ID WHERE p2c.category_id = $categoryId AND p.post_status = 'publish'
   ORDER BY post_date DESC" . $limit;`
 * Since I don’t speak MySQL :P, how should this string be built so I can stop getting
   the “table not found” message?
 * Thanks in advance for any help.
 *  [isometric](https://wordpress.org/support/users/isometric/)
 * (@isometric)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625109)
 * I’m also getting a similar error in regards to Posting Comments, Posts and removing
   Comments/Posts.
    Here is what I’m getting :
 * > WordPress database error: [Table ‘web6_db1.wp_post2cat’ doesn’t exist]
   >  SELECT
   > YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, category_id FROM wp_posts
   > INNER JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE post_date
   > > 0 AND category_id <> 0 AND ID = 95 ORDER By post_date DESC
   > Warning: Cannot modify header information – headers already sent by (output
   > started at /var/www/web6/web/wp-includes/wp-db.php:160) in /var/www/web6/web/
   > wp-includes/pluggable.php on line 390
 * I have already imported the old SQL backup I made and re-ran the upgrade.php 
   with all Plug-ins disabled but still no luck. 🙁
 * So I’m assuming it has something to do with my Theme?
    I am using iTheme 1.1…
 * This really sucks 🙁
 *  [monadfm](https://wordpress.org/support/users/monadfm/)
 * (@monadfm)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625117)
 * I upgraded to 2.3 and my wp_categories tables disappeared from my database. All
   I did was replace the tables with my backup and ran upgrade again and it is working.
   Wanted to let you know in case this will help anyone.
 *  [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/3/#post-625125)
 * I’m getting the error simply by using query_posts in my sidebar to get recent
   posts from a specific category:
 *     ```
       <?php query_posts('cat=43&showposts=10');
        while (have_posts()) : the_post();?>
       <div class="foo">
       <?php the_content(); ?>
       <a href="<?php the_permalink(); ?>#comments"
       class="commentlink"></a></div>
       <?php endwhile; ?>
       ```
   
 * Suggestions welcome.
 * ETA: It seems that `cat=43` needs to become `term=43`, but the query no longer
   works as expected. It’s pulling up the last 10 posts regardless of their categories.
 *  [producte](https://wordpress.org/support/users/producte/)
 * (@producte)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625140)
 * Well, for me, the only temporary fix I’ve found is disabling this plugin:
 * Extended Live Archives 0.10beta-r16
 * Implements a dynamic archive, inspired by Binary Bonsai and the original Super
   Archives by Jonas Rabbe. Visit the ELA option panel to initialize the plugin.
   By Arnaud Froment ([http://www.sonsofskadi.net/](http://www.sonsofskadi.net/)).
 * Then, it works perfectly. Activating it, the errors comes back. A pitty, it’s
   a cool plugin for archives.
 *  [Doug Smith](https://wordpress.org/support/users/douglsmith/)
 * (@douglsmith)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625146)
 * I put together a plugin that will scan through other plugins and themes to look
   for potential conflicts with WordPress 2.3. It may be of help to others in their
   upgrade process. I recommend running it before upgrading to identify possible
   problems, but it can also be used after the fact to help find the source of errors.
 * You can find it here: [Upgrade Preflight Check](http://smithsrus.com/downloads/wordpress-upgrade-preflight-check/).
 *  [ibrahimcesar](https://wordpress.org/support/users/ibrahimcesar/)
 * (@ibrahimcesar)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625159)
 * Thanks douglsmith! Very helpful! Work in 2 blogs, on another one I disable a 
   certain plugin (WordPress Automatic Upgrade) and my Admin turn blank! I just 
   got blank pages…I cannot acess my admin pages! Someone can help me?
 * Thanks!
 *  [drewminstry](https://wordpress.org/support/users/drewminstry/)
 * (@drewminstry)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625160)
 * Douglsmith thats totally brilliant!
    I just wish I’d had that before I decided
   to upgrade yesterday – I’d vote that your plugin should be added to all future
   releases of WP. I’d like to know what’s likely to be broken by an upgrade before
   I run it!
 * OK. so the issue is fixable either by changing plug-ins or themes.
    And reading
   above, I get the impression that the code for the default theme has changed 2.2
   to 2.3. Can anyone point me to a listing of those changes? I’ve got a theme that
   is a customised version of default made for 2.2, and I’d like to check it through,
   as it’s likely that it is my problem. and I’d like to manually replicate any 
   changes to default theme.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625162)
 * sillybean: No, the “cat” variable should continue to work just fine for query_posts.
   If you’re getting any sort of category error from that, then you’re either using
   a plugin that modifies the query, or you failed to update all the files in wp-
   includes.
 * About a third of the complaints I see in here seem to be from failing to update*
   all* the WordPress files. Make sure that you upload ALL the files, people.
 * Also, disable all plugins before upgrading. Then re-enable them, one at a time.
   The changes in 2.3 are large, so the odds something will break your plugins is
   high. Look for upgraded or alternative plugins when you find one that breaks 
   something.
 *  [isometric](https://wordpress.org/support/users/isometric/)
 * (@isometric)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/3/#post-625163)
 * Producte is right.
    I also disabled the Extended Live Archives yesturday and 
   everything seems to be working fine now.

Viewing 15 replies - 31 through 45 (of 100 total)

[←](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/2/?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 [4](https://wordpress.org/support/topic/solution-for-database-errors-wp_post2cat-does-not-exist/page/4/?output_format=md)
[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/4/?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
