wpdb – Counting Posts with multiple taxonomy and terms condition using MySQL and AJAX
I am trying to get the number of posts with multiple taxonomy and terms using MySQL and AJAX. but I cannot get the desired result with my query. I derived my query in this wpdb query and sadly it returns 0. I am hoping anyone can give me the exact sql query for this one. very much appreciated.
Here is my current Query:
SELECT p.post_title, p.post_content FROM wp_posts AS p INNER JOIN wp_term_relationships AS tr ON ('p.ID' = tr.object_id) INNER JOIN wp_term_taxonomy AS tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) INNER JOIN wp_terms AS t ON (t.term_id = tt.term_id) WHERE p.post_status="publish" AND p.post_type="company" AND tt.taxonomy = 'repair_duration' AND t.name="days" ORDER BY p.post_date DESC
this one is for a single condition, and I am trying to achieve searching with multiple values of terms. I tried using WHERE IN but still no luck.
Search A company that has taxonomy of repair_duration and terms of day, minutes and has taxonomy of repair_quality and terms of good, best
I really appreciate your responses.
currently I am working on wpdb query on ajax, if that’s possible.