im trying to extract the following fields from a local wordpress installation
- post_title
- image_url
- post_excerpt
other criteria for the SELECT is:
- the status is publish
- it's a post item
- and the results only come from the projects parent category or any subcategory of project
i've got this far already but am finding it difficult to workout the rest
SELECT DISTINCT wp_posts.post_title, wp_postmeta.meta_value
FROM wp_posts, wp_term_relationships, wp_term_taxonomy, wp_postmeta
WHERE wp_term_relationships.object_id = wp_posts.ID
AND post_status = 'publish'
AND post_type = 'post'
AND wp_postmeta.meta_key = 'image_url'
AND wp_term_taxonomy.parent = 5
ORDER BY wp_posts.post_date DESC
as per the below comment, table for wp_term_taxonomy is: term_taxonomy_id || term_id || taxonomy || description || parent || count
as per the below comment, table for wp_posts is: ID || post_author || post_date || post_content || post_title|| post_excerpt || post_status there are more, but not relevant here
as per the below comment, table for wp_term_relationships is: object_id ||term_taxonomy_id || term_order
as per the below comment, table for wp_postmeta is: meta_id || post_id || meta_key || meta_value