klongdesigns
5/13/2014 - 7:07 PM

SQL Query to pull post title, name and cateogry

SELECT post.post_title, post.post_name, tt.name
FROM  `wp_posts` AS post
INNER JOIN  `wp_term_relationships` AS terms ON ( post.ID = terms.object_id ) 
INNER JOIN  `wp_term_taxonomy` AS tax ON ( terms.term_taxonomy_id = tax.term_taxonomy_id ) 
INNER JOIN  `wp_terms` AS tt ON ( tax.term_id = tt.term_id ) 
WHERE post.post_type =  'post'