Bird
0
0

You want to create a custom function that schedules a post only if the post status is 'draft' and the date is in the future. Which condition correctly checks this before scheduling?

hard📝 Application Q8 of 15
Wordpress - Content Management
You want to create a custom function that schedules a post only if the post status is 'draft' and the date is in the future. Which condition correctly checks this before scheduling?
Aif ($post_status !== 'draft' && strtotime($post_date) >= time())
Bif ($post_status === 'future' || strtotime($post_date) < time())
Cif ($post_status === 'draft' && strtotime($post_date) > time())
Dif ($post_status === 'publish' && strtotime($post_date) > time())
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct status and date check

    We want to schedule only if status is 'draft' and date is future, so both conditions must be true.
  2. Step 2: Analyze each option

    if ($post_status === 'draft' && strtotime($post_date) > time()) matches both conditions correctly; others have wrong status or date comparisons.
  3. Final Answer:

    if ($post_status === 'draft' && strtotime($post_date) > time()) -> Option C
  4. Quick Check:

    Check draft status AND future date before scheduling [OK]
Quick Trick: Use AND to check draft status and future date together [OK]
Common Mistakes:
  • Using OR instead of AND
  • Checking wrong status
  • Comparing date incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes