Bird
0
0

Which of the following is the correct way to set a post's status to 'draft' using wp_insert_post?

easy📝 Syntax Q12 of 15
Wordpress - Content Management
Which of the following is the correct way to set a post's status to 'draft' using wp_insert_post?
A{'post_status' => 'publish'}
B{'post_status' => 'draft'}
C{'status' => 'draft'}
D{'poststate' => 'draft'}
Step-by-Step Solution
Solution:
  1. Step 1: Check the correct argument name for status

    The correct key to set post status is post_status.
  2. Step 2: Verify the value for draft status

    The value to set a post as draft is exactly 'draft'.
  3. Final Answer:

    {'post_status' => 'draft'} -> Option B
  4. Quick Check:

    Use 'post_status' key with 'draft' value [OK]
Quick Trick: Use 'post_status' key, not 'status' or 'poststate' [OK]
Common Mistakes:
  • Using wrong key like 'status' or 'poststate'
  • Setting 'publish' instead of 'draft'
  • Misspelling 'post_status'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes