Using query_posts to get list of matching taxonomy
-
I am so confused when it comes to using WP_Query $args to get the information I am looking for. My site has custom taxonomy. I am attempting to pull all like items based on the selected taxonomy terms the user saves. I think I have to use tax_query as part of the $args to get the result but I am stuck.
Here is my call so far:
$final_terms is an array of term names
Array
(
[0] => 15 minutes or less
[1] => 30 minutes of less
[2] => Salad
[3] => Snack
[4] => Mexican
[5] => Fruit
[6] => Meat
[7] => Breakfast
[8] => Lunch
[9] => Dinner
)that match the name field in the wp_terms. Those terms match the group (taxonomy) in the wp_term_taxonomy table.
$query_args = array( 'post_type' => 'recipe', 'paged' => $paged, 'paged' => $paged, 'tax_query' => array( array( 'field' => 'name', 'terms' => $final_terms ) ), );
I need to pull all the recipes that share the same term.
- The topic ‘Using query_posts to get list of matching taxonomy’ is closed to new replies.