Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have some categories which are not correctly defined. I.e. their parents are messed up. How can I select with SQL all categories and their parents?

share|improve this question

1 Answer 1

Something like this should work:

select t.name cat, p.name parent 
from wp_terms t, wp_term_taxonomy tt, wp_terms p
where tt.term_id=t.term_id and tt.parent=p.term_id

(this only returns categories with a parent)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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