Support » Fixing WordPress » Solution for 2.3 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:

    It could also be that your theme is causing this error:

    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.

Viewing 10 replies - 91 through 100 (of 100 total)
  • hi!
    Just a comment about new database squeme.
    If you read the document:

    http://codex.wordpress.org/Database_Description

    to understand more about how is now defined the wordpress database, you can see that in the wp_posts table, the field “post_category” has a FK to wp_categories.cat_ID, and this tables has been removed.

    The second thing is that I have searched in http://codex.wordpress.org/Plugins/Plugin_Compatibility/2.3

    for any useful and available plugin compatible with version 2.3.1 that cover my needs, and I have seen that “Advanced Category Excluder” plugin has been tested and it works without issues, but before use it I have decided to have a look into the php code, and I have seen that it makes somes queries to “post2cat” table, the other one that have already been removed. So I’m not decided to use this plugin although it’s on the compatibility list.

    I wonder if someone have an answer to understand it.
    Thanks,
    Sandra.

    On what I’ve read here, my impression is that changes in design of database and algorithm have not been published before 2.3 came out. They may have been in another place but clear reference to these documents is simply missing. If these would have been published before 2.3 came out, developers of themes and plug-ins would have had the change to adjust their code and test it against 2.3 before running into problems like this.

    In case of a program that is so widely used, the developers should have taken this into account.

    However, on the user’s side, I have the impression that some just update. I found it a good habit to TEST new versions of software, and especially if there are major changes in design, either software or database.
    Read the release notes. Read the installation guide. In advance, not AFTER damage is done. In that case, you are somewhat prepared and know where danger lurks.
    If you haven’t and run into problems with your live blog – don’t blame the product but yourself.

    Okay. I am new to all of this, and am in WAY over my head! I upgraded to the new wordpress version and on my webpage http://www.donna-scott.com is an error message that says: Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /home/donntcom/public_html/wp-includes/category-template.php on line 176

    I have no clue what this means or how to fix it. I have been reading on here and you guys are talking a whole other language! lol seriously. I dont know how to do codes and files and such. I have an FTP program but dont have a clue where to download the files too. Can someone help me?? please!

    I am getting this message every time I upgrade my database. I’ve ununstalled and reinstalled WordPress and then the database. But still getting it.

    I’ve also removed every plugin I was using, and the theme I am using I’m pretty sure is compatible.

    This is the message:

    WordPress database error: [Table ‘h4ppy.wp_categories’ doesn’t exist]
    SELECT * FROM wp_categories ORDER BY cat_ID

    WordPress database error: [Table ‘h4ppy.wp_post2cat’ doesn’t exist]
    SELECT post_id, category_id FROM wp_post2cat GROUP BY post_id, category_id

    WordPress database error: [Table ‘h4ppy.wp_linkcategories’ doesn’t exist]
    SELECT cat_id, cat_name FROM wp_linkcategories

    Upgrade Complete
    Your WordPress database has been successfully upgraded!

    Can someone please help?!

    I was having problems also until I reinstalled WP this way:

    Deleted all *.php files in WP root EXCEPT config;
    Deleted wp-admin folder
    Deleted wp-includes folder
    Re-uploaded WP 2.3.2

    Navigated to wp-admin/upgrade.php and let the program tell me that my database needed to be upgraded and clicked on the link to do so.

    Once I did it that way, the problems went away. You cannot let Fantastico upgrade the files for you; won’t work. Also it seems to be hit or miss if you just overwrite the old files.

    Make sure you make a backup of your MySQL database before doing any of this. (But you knew that already, right?) 🙂

    I’ve read these 4 pages of comments on the post2cat issue. I just upgraded to 2.3.3. I followed EXACTLY the detailed instructions. I am now using the default theme. There are no plugins installed (yes, I deactivated them before the upgrade). As a matter of fact, I deleted the plugin folder. I’m getting this error and several others.

    There were multiple problems with the upgrade. Some were easily fixed by uploading specific files. It appears either my webhosting server or my satellite internet interfered with the correct uploading of these files.

    Any help is welcome.

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    What plugins did you have before upgrading?

    Hi I know this is discussion is all about 2.3 but just for other readers who may come here and use 2.5. I had the same problem and resolved it when I deactivated jerome’s keywords. Johan

    Wow. I just logged into the server and did this:

    grep -R wp_post2cat *

    And I got nothing back! Can anyone think of how I’m getting these errors, which mention wp_post2cat, when “wp_post2cat” doesn’t appear in any file in my WordPress installation? Could some queries actually be stored in the database?

    I’m running grep recursively from the top level of the site, so everything, including all plugins and themes, should be included here.

    Version 2.5.1 is totally screwing up my site.

    whooami

    (@whooami)

    Member

    wow, I just answered your question in YOUR thread — and I got nothing back.

    Can anyone tell me why …

Viewing 10 replies - 91 through 100 (of 100 total)
  • The topic ‘Solution for 2.3 database errors / wp_post2cat does not exist’ is closed to new replies.