Bird
0
0

You want to display a list of posts filtered by a custom metadata key 'rating' with value '5'. Which approach correctly extends content using metadata?

hard📝 Application Q15 of 15
Wordpress - Custom Fields and Meta Data
You want to display a list of posts filtered by a custom metadata key 'rating' with value '5'. Which approach correctly extends content using metadata?
AUse WP_Query with 'meta_key' => 'rating' and 'meta_value' => '5'
BManually edit post content to add 'rating:5' text
CUse get_post_meta() to change post titles
DDelete posts without 'rating' metadata
Step-by-Step Solution
Solution:
  1. Step 1: Understand filtering by metadata

    WP_Query supports filtering posts by metadata using 'meta_key' and 'meta_value' parameters.
  2. Step 2: Evaluate options

    Use WP_Query with 'meta_key' => 'rating' and 'meta_value' => '5' uses WP_Query correctly; A misuses get_post_meta(), B changes content text, D deletes posts unnecessarily.
  3. Final Answer:

    Use WP_Query with 'meta_key' => 'rating' and 'meta_value' => '5' -> Option A
  4. Quick Check:

    Filter posts by metadata with WP_Query [OK]
Quick Trick: Filter posts by metadata using WP_Query meta_key/meta_value [OK]
Common Mistakes:
  • Editing content text instead of using metadata
  • Misusing get_post_meta() for filtering
  • Deleting posts instead of filtering

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes