Bird
0
0

Given this code snippet, what will be the output on the post edit screen?

medium📝 component behavior Q13 of 15
Wordpress - Custom Fields and Meta Data
Given this code snippet, what will be the output on the post edit screen?
add_action('add_meta_boxes', function() {
  add_meta_box('my_box', 'My Box', function() {
    echo '<input type="text" name="my_field" value="Hello" />';
  }, 'post');
});
AA checkbox labeled 'My Box' with 'Hello' inside
BA text input box labeled 'My Box' with 'Hello' inside
CNo meta box will appear because 'post' is invalid
DAn error because the callback function is missing parameters
Step-by-Step Solution
Solution:
  1. Step 1: Analyze add_meta_box parameters

    The ID is 'my_box', title is 'My Box', callback outputs a text input with value 'Hello', and screen is 'post'.
  2. Step 2: Understand the callback output

    The callback prints an input box of type text with name 'my_field' and value 'Hello'.
  3. Final Answer:

    A text input box labeled 'My Box' with 'Hello' inside -> Option B
  4. Quick Check:

    Callback outputs text input with value 'Hello' [OK]
Quick Trick: Callback echoes input field HTML inside meta box [OK]
Common Mistakes:
  • Thinking callback needs parameters to work
  • Assuming 'post' is invalid screen
  • Confusing input types (text vs checkbox)

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes