Bird
0
0

Identify the error in this code snippet:

medium📝 Debug Q6 of 15
Wordpress - Custom Fields and Meta Data
Identify the error in this code snippet:
add_option('header_text', 'Welcome');
update_option('header_text');
Aupdate_option missing second parameter for new value
Badd_option should be update_option
COption name should be an array
DNo error, code is correct
Step-by-Step Solution
Solution:
  1. Step 1: Check update_option usage

    update_option requires two parameters: option name and new value.
  2. Step 2: Identify missing parameter

    The code calls update_option with only the option name, missing the new value.
  3. Final Answer:

    update_option missing second parameter for new value -> Option A
  4. Quick Check:

    update_option needs two parameters [OK]
Quick Trick: update_option always needs new value parameter [OK]
Common Mistakes:
  • Calling update_option with one argument
  • Confusing add_option and update_option
  • Passing array instead of string for option name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes