0
0
Wordpressframework~5 mins

Tax queries and meta queries in Wordpress - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Acategory_name
Bmeta_query
Ctax_query
Dpost_type
What does the 'meta_query' filter in WordPress?
APost categories
BPost dates
CPost authors
DCustom fields (post meta)
How do you combine multiple conditions inside a tax_query?
AUsing 'combine' key with 'ALL'
BUsing 'relation' key with 'AND' or 'OR'
CUsing 'join' key with 'AND'
DUsing 'filter' key with 'OR'
Which compare operator would you use in meta_query to find posts with a meta value less than 100?
A<
B>
C=
DLIKE
If you want posts that match either one taxonomy term or another, which 'relation' value should you use?
AOR
BNOT
CAND
DXOR
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.