Bird
0
0

What will be the output of this code snippet?

medium📝 Predict Output Q5 of 15
Wordpress - Custom Fields and Meta Data
What will be the output of this code snippet?
delete_option('footer_text');
echo get_option('footer_text', 'Default footer');
A'' (empty string)
BDefault footer
Cfooter_text
DError: Option does not exist
Step-by-Step Solution
Solution:
  1. Step 1: Understand delete_option effect

    delete_option removes 'footer_text' from the database.
  2. Step 2: Use get_option with default value

    Since 'footer_text' no longer exists, get_option returns the default 'Default footer'.
  3. Final Answer:

    Default footer -> Option B
  4. Quick Check:

    Deleted option returns default value [OK]
Quick Trick: get_option returns default if option missing [OK]
Common Mistakes:
  • Expecting empty string instead of default
  • Assuming error on missing option
  • Confusing option name with value

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes