I want to select records from wordpress database based on two taxonomy conditions. I have the following query.But it lists all the records.I want to filter the following query with taxonomy recipe-category and term 90 .How can i do this?
select DISTINCT p.ID, p.post_author,p.post_date as dte,wt.term_id from wp_posts p left JOIN wp_postmeta m1 ON p.ID = m1.post_id left JOIN wp_term_relationships wtr ON (p.ID = wtr.object_id) left JOIN wp_term_taxonomy wtt ON (wtr.term_taxonomy_id = wtt.term_taxonomy_id) left JOIN wp_terms wt ON (wt.term_id = wtt.term_id) where p.post_type='recipe' and p.post_status='publish' AND (wtt.taxonomy = 'recipe-cuisine' and wtt.term_id IN (17) ) order by dte DESC