[wp-testers] SQL query to troubleshoot wp_term and related tables

Bruce Keener brucekeener at gmail.com
Sat Oct 13 15:30:43 GMT 2007


A few months back I used the 2.3alpha, and then back to a 2.2 version. Then,
about a month before release of 2.3, I started using it again. I initially
had some trouble with categories and tags because of being a "re-installer,"
but got that straightened out a few weeks ago.

Operationally everything seems to be well. However, in using Alex King's
Articles plugin, I get an Articles page that has some of my posts classified
under very wrong categories. I look at the posts, and they are indeed
classified right, but King's plugin bins them incorrectly.

I could lay the blame on his plugin, but it works fine on his site, he says
it is 2.3 capable, and his plugins are generally highly regarded. Therefore,
I am suspecting there is something stilled hosed up in some of my wp_term
related tables.

To fix the category and tag problems a few weeks ago, I manually edited some
items in the wp_terms table: I deleted some categories that were out of date
(I had deleted them when I went back to 2.2 but my old version of
2.3alphadid not see the deletions and kept them), I changed a couple
of tags to have
a '0' designation instead of a '1' (they used to be categories, but I
deleted the categories a long ago and recently made them tags), and so on.

But, I have not touched wp_term_relationships or any other table (because I
do not understand the other term tables), and am now wondering if I have
gotten something 'out of sync.'

So, not being an SQL guru, is there are query I can run that will give me a
row-by-row listing of a tag/category and everything related to it, so I can
look for patterns and see if I have hosed something?

Also, I wonder if I am missing a table: I count 11 in the database ... is
that correct?

Sorry for any lack of clarity. I am at wits end on this. I do not have a
saved database that I could resort to, except one that is far too old and
that would be not have dozens of new posts.


More information about the wp-testers mailing list