I have my main site, www.whatsthatbug.com, and a test site, test.whatsthatbug.com. They are identical as far as I can tell - same version of wordpress, same plugins at the same versions, same theme with the same modifications.

And yet.

The category widget on www shows a count of the parent category but does not include the subcategories in the count, whereas on test (and the way it always worked until recently on www), the category count includes the subtotals for the subcategories.


In wp-admin/edit-tags.php?taxonomy=category on www, I see no subcategories for any of the categories. Which makes some things difficult. And it means something is broken. On test, the subcategories are there as they should be (and as they used to be on www).

These two things seem related.

I thought it was some corruption in one of the wp_term tables, so I copied the data from test to www. No difference.

Any suggestions on where I should be looking at this point are most welcome. test is a snapshot from a few weeks ago. I suppose I could, worst case, export the posts and comments since then, import them into test, and make test into www. But that seems messy. And I'd like to know what went wrong here, anyway.

So, thank you in advance (and later as well) for any advice thrown my way.

For clarification, here is what I see on test.whatsthatbug.com for wp-admin/edit-tags.php?taxonomy=category: Correct category display from test.whatsthatbug.com

And here is what I see on www.whatsthatbug.com: Incorrect category display from www.whatsthatbug.com

And here is categories with counts from test:

test.whatsthatbug.com categories with counts

and from www:

www.whatsthatbug.com categories with counts

EDIT: In trying to troubleshoot this, I added this to the bottom of wp-admin/edit-tags.php:

wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'select_name', 'hierarchical' => true, 'orderby' => 'name', 'order' => 'ASC'));

And it has the child categories for each parent category. I am lost as to why those child categories are not showing up on that page as shown in the image above. It does not appear to be a corrupt database...


2 Answers 2


WordPress' terms and taxonomies are spread over three tables in the database. Those tables are wp_terms, wp_term_relationships and wp_term_taxonomy - see the codex article on Database Description for more details. The parent relationship is part of the wp_term_taxonomy table, so you should inspect the differences between your environments in this table. wp_terms does not store such parent relationship information, so it's no surprise that copying it didn't change anything for you.

  • I should have been more specific - I copied over all 3 tables: wp_terms, wp_term_relationships and wp_term_taxonomy. Sep 17, 2014 at 16:39
  • Yes, it's kind of a relevant piece of information ;) Too bad actually, because that would have been the easy way out. Now it's a bit more complicated and with the given information not really solvable. Maybe you get some kind of cached content? Or there is a difference between those environments, like plug-ins or snippets in your functions.php. Basically, find the difference, like in those picture games, and you have the solution. And something must be different, otherwise the result would be the same. @DanielJacobs Sep 17, 2014 at 20:40
  • Caching wouldn't enter into it since it's on the admin side. Well, thank you for your suggestions. I'll keep hammering at it. Sep 17, 2014 at 21:09
  • Do I know what you do in your setup? But I see you solved it, so I guess it's all good. @DanielJacobs Sep 17, 2014 at 21:34

Well, that was interesting and unexplained.

I went to wp-admin/edit-tags.php?taxonomy=category and added a new dummy subcategory under a top level category, and then deleted it. Lo and behold, both of my problems are gone. Visit www.whatsthatbug.com and see for yourself if you wish. I have no idea what caused the problem or why that would have fixed it, but I'm moving on. This problem is solved.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.