Bird
0
0

Given this block registration code snippet, what will be the saved content output in the post?

medium📝 component behavior Q13 of 15
Wordpress - Shortcodes and Blocks
Given this block registration code snippet, what will be the saved content output in the post?
registerBlockType('myplugin/simple', {
  edit: () => {
    return wp.element.createElement('p', null, 'Hello Editor');
  },
  save: () => {
    return wp.element.createElement('p', null, 'Hello Saved');
  }
});
A<p>Hello Editor</p>
B<p>Hello Saved</p>
CHello Editor
DHello Saved
Step-by-Step Solution
Solution:
  1. Step 1: Understand the difference between edit and save functions

    The edit function controls what the editor shows while editing. The save function controls what HTML is saved and shown on the front end.
  2. Step 2: Identify the saved output

    The save function returns a paragraph with text 'Hello Saved', so this is the content saved in the post and shown to visitors.
  3. Final Answer:

    <p>Hello Saved</p> -> Option B
  4. Quick Check:

    Saved content = save() output = <p>Hello Saved</p> [OK]
Quick Trick: Remember: save() output is what visitors see [OK]
Common Mistakes:
  • Confusing edit() output with saved content
  • Ignoring that save() returns HTML elements
  • Assuming edit() content is saved

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes