Recall & Review
beginner
What is a tax query in WordPress?
A tax query lets you filter posts based on taxonomy terms like categories or tags. It helps you get posts that belong to specific groups.
Click to reveal answer
beginner
What is a meta query in WordPress?
A meta query filters posts by custom fields (post meta). It lets you find posts with specific meta key and value pairs.
Click to reveal answer
intermediate
How do you combine tax queries and meta queries in WP_Query?
You add both 'tax_query' and 'meta_query' arrays inside the WP_Query arguments. WordPress will filter posts that match both conditions.
Click to reveal answer
intermediate
What does the 'relation' key do in tax_query or meta_query arrays?
The 'relation' key sets how multiple conditions are combined: 'AND' means all must match, 'OR' means any can match.
Click to reveal answer
intermediate
Give an example of a meta_query to find posts where 'price' is greater than 20.
Example: 'meta_query' => [ ['key' => 'price', 'value' => 20, 'compare' => '>', 'type' => 'NUMERIC'] ]
Click to reveal answer
Which argument do you use to filter posts by taxonomy terms in WP_Query?
✗ Incorrect
The 'tax_query' argument filters posts by taxonomy terms like categories or tags.
What does the 'meta_query' filter in WordPress?
✗ Incorrect
'meta_query' filters posts based on custom fields (post meta) values.
How do you combine multiple conditions inside a tax_query?
✗ Incorrect
The 'relation' key defines how multiple tax_query conditions are combined, either 'AND' or 'OR'.
Which compare operator would you use in meta_query to find posts with a meta value less than 100?
✗ Incorrect
Use '<' to find meta values less than a specified number.
If you want posts that match either one taxonomy term or another, which 'relation' value should you use?
✗ Incorrect
'OR' means posts matching any of the taxonomy terms will be included.
Explain how to use tax_query and meta_query together in a WP_Query to filter posts.
Think about filtering posts by categories and custom fields at the same time.
You got /4 concepts.
Describe the purpose of the 'relation' key in tax_query or meta_query arrays.
It’s like deciding if you want all or any conditions to be true.
You got /3 concepts.