0

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?

1 Answer 1

2

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)

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.