How to list all categories and their IDs using SQL query?

Question

I am looking for a SQL Query that can give the list of all categories created in WordPress Site along with it’s category IDs. Please advise a query to get it as category/term relationship is quite complex in WordPress.

I got this but didn’t work –

SELECT ID,post_title FROM wp_posts INNER JOIN wp_term_relationships ON wp_term_relationships.object_id=wp_posts.ID INNER JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id=wp_term_relationships.term_taxonomy_id INNER JOIN wp_terms ON wp_terms.term_id=wp_term_taxonomy.term_id WHERE name='category'
0
, , amitdutt24 3 years 2020-08-24T04:10:21-05:00 0 Answers 47 views 0

Leave an answer

Browse
Browse