Bird
0
0

To retrieve posts from a category with ID 8 using WP_Query, which argument should you include?

easy📝 Conceptual Q2 of 15
Wordpress - WordPress Query and Database
To retrieve posts from a category with ID 8 using WP_Query, which argument should you include?
A'post_category' => 8
B'category_name' => 8
C'tag_id' => 8
D'cat' => 8
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct argument for category ID

    The 'cat' argument accepts a category ID to filter posts.
  2. Step 2: Review other options

    'category_name' expects a slug, 'tag_id' is for tags, and 'post_category' is invalid.
  3. Final Answer:

    'cat' => 8 -> Option D
  4. Quick Check:

    Use 'cat' for category ID in WP_Query [OK]
Quick Trick: 'cat' argument filters by category ID [OK]
Common Mistakes:
  • Using 'category_name' with an ID instead of slug
  • Confusing tags with categories
  • Using invalid argument names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes