Retrieve posts by term id custom query
Question
i want to retrieve custom posts using using custom query .
my taxonomy is recipe_tx and
terms
(Beef) , (Chicken) etc in it .
i have tried using
SELECT p.* FROM wp_posts p, wp_term_taxonomy tt, wp_term_relationships tr
WHERE p.ID=tr.`object_id`
AND tt.`term_id`=tr.`term_taxonomy_id`
AND (p.post_type = 'recipe_cpt')
AND p.post_status = 'publish'
AND tt.`term_taxonomy_id` = 37
but no luck .
can someone help me how to get wp posts by their term_id .
if beefs id is 37 then i want to retrieve all the posts
with term_id = 37
Thank’s
0
4 months
0 Answers
15 views
0
Leave an answer
You must login or register to add a new answer .