I'm trying to query all posts from my Wordpress site that have wp_terms.slug = 'portfolio-photos'. I've connected the tables using wp_terms, wp_term_taxonomy, wp_term_relationships and wp_posts. I'm not sure what's wrong with the SQL code I have. Can someone advise what's wrong with my code/train of thought on this?
I receive 0 rows, however, there should be 12 rows because that's how many I have in WP with the "portfolio-photos" slug. The column headers are ID, term_id, and slug.
SELECT wp_posts.ID, wp_terms.term_id, wp_terms.slug
FROM wp_posts
LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
LEFT JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)
LEFT JOIN wp_terms ON (wp_term_taxonomy.term_taxonomy_id = wp_terms.term_id)
WHERE wp_terms.slug = 'portfolio-photos'