Bird
0
0

Given this meta_query:

medium📝 Predict Output Q5 of 15
Wordpress - WordPress Query and Database
Given this meta_query:
array(
'relation' => 'OR',
array('key' => 'color', 'value' => 'blue', 'compare' => '='),
array('key' => 'size', 'value' => 'large', 'compare' => '=')
)

What posts will this query return?
APosts with color 'blue' and size 'large'
BPosts with color 'blue' only
CPosts with size 'large' only
DPosts with color 'blue' or size 'large'
Step-by-Step Solution
Solution:
  1. Step 1: Understand relation 'OR'

    Posts matching any one of the meta_query conditions are included.
  2. Step 2: Analyze conditions

    Posts with meta key 'color' equal to 'blue' or meta key 'size' equal to 'large'.
  3. Final Answer:

    Posts with color 'blue' or size 'large' -> Option D
  4. Quick Check:

    meta_query relation OR means either condition matches [OK]
Quick Trick: 'OR' relation returns posts matching any meta condition [OK]
Common Mistakes:
  • Assuming 'OR' means both conditions must match
  • Ignoring the relation argument
  • Confusing meta_query with tax_query

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes