Support » Fixing WordPress » Missing Table – wp_termwp_relationships

  • I was missing my categories and tags and after digging around I am missing my wp_termwp_relationships table.

    Any clue on how to fix this? Even If I have to manually re-populate the table manually – that is fine.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You can recreate the table easily enough, but the data in the table will be a problem. Did you recently do anything that may have resulting in losing that table? Move the site, or dump/import the database for some reason? Tables usually don’t just disappear.

    I was cleaning up some plugins that I was not using and clearing out databases that I didn’t need. Evidently I checked this one by mistake.

    I do have a database backup plugin, but when I go to restore the database, it says it fails.

    I am at a loss on what to do.

    Did your database have option –add-drop-table?
    If did you just import the database backup, if did’nt you should remove all table first, then import the database backup.

    I do have a database backup plugin, but when I go to restore the database, it says it fails.

    Do you have a backup you made using that plugin? If so, then you should be able to open it in a text editor, find the table entries and restore them.

    Well… I thought my plugin was working correctly (I was getting weekly emails). Evidently it wasn’t so I don’t have a backup now.

    Should I just export my wordpress files and then install a new fresh copy with a new database. I am thinking at this point that is the only thing I can do. If this is the case, any pointers would be greatly appreciated.

    You could do that, but I’m not sure the data will be recreated. If that table is the only one missing, then you could just recreate it. The sql for creating the table is below…you could copy that, past into a text file using notepage, rename the file with a .sql extension and then import it into your database to recreate the table. Again, you won’t have the data, so I assume you would need to re-tag and categorize your posts. I’m just making some assumptions that you can’t get this data back…there may be a way to get these relationships back, but I’ve never experimented with it.

    CREATE TABLE IF NOT EXISTS <code>wp_term_relationships</code> (
      <code>object_id</code> bigint(20) NOT NULL default '0',
      <code>term_taxonomy_id</code> bigint(20) NOT NULL default '0',
      <code>term_order</code> int(11) NOT NULL default '0',
      PRIMARY KEY  (<code>object_id</code>,<code>term_taxonomy_id</code>),
      KEY <code>term_taxonomy_id</code> (<code>term_taxonomy_id</code>)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Missing Table – wp_termwp_relationships’ is closed to new replies.