Вот, разные SQL запросы... адаптируйте их под свои задачи:
SELECT wp_posts.ID, wp_posts.post_title, wp_terms.name, wp_postmeta.meta_key, wp_postmeta.meta_value
FROM wp_posts
JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id
JOIN wp_term_relationships ON wp_posts.ID = wp_term_relationships.object_id
JOIN wp_terms ON wp_term_relationships.term_taxonomy_id = wp_terms.term_id
JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
WHERE wp_posts.post_status = 'publish' AND wp_posts.post_type='post';
SELECT *
FROM wp_posts
JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id
JOIN wp_term_relationships ON wp_posts.ID = wp_term_relationships.object_id
JOIN wp_terms ON wp_term_relationships.term_taxonomy_id = wp_terms.term_id
JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
WHERE wp_posts.post_status = 'publish' AND wp_posts.post_type='post';