Bird
0
0

Which of the following is the correct syntax to update an option named 'site_mode' to 'maintenance'?

easy📝 Syntax Q3 of 15
Wordpress - Custom Fields and Meta Data
Which of the following is the correct syntax to update an option named 'site_mode' to 'maintenance'?
Aupdate_option('site_mode' => 'maintenance');
Bupdate_option('site_mode', 'maintenance');
Cupdate_option('site_mode', maintenance);
Dupdate_option(site_mode, 'maintenance');
Step-by-Step Solution
Solution:
  1. Step 1: Review the correct function signature

    update_option() takes two parameters: the option name as a string and the new value as a string or other data type.
  2. Step 2: Check syntax correctness

    update_option('site_mode', 'maintenance'); correctly passes both parameters as strings. Options A, C, and D have syntax errors or missing quotes.
  3. Final Answer:

    update_option('site_mode', 'maintenance'); -> Option B
  4. Quick Check:

    Correct update_option syntax = update_option('site_mode', 'maintenance'); [OK]
Quick Trick: Use quotes for both option name and value [OK]
Common Mistakes:
  • Missing quotes around strings
  • Using arrow syntax instead of comma
  • Passing variables without quotes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes