0
0
Wordpressframework~20 mins

Gutenberg block editor basics in Wordpress - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Gutenberg Block Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What happens when you add a paragraph block in Gutenberg?
You add a paragraph block in the Gutenberg editor and start typing. What is the expected behavior?
AThe block does not allow typing until you save the post first.
BThe block automatically converts text into a heading without user input.
CThe block only accepts HTML code and shows raw tags instead of formatted text.
DThe block accepts text input and displays it immediately inside the editor.
Attempts:
2 left
💡 Hint
Think about how a paragraph block works in a normal text editor.
📝 Syntax
intermediate
2:00remaining
Which code snippet correctly registers a custom block in Gutenberg?
You want to register a custom block using JavaScript in Gutenberg. Which snippet is correct?
Awp.blocks.newBlock('my-plugin/my-block', { title: 'My Block', save: () => 'Save' });
Bwp.blocks.registerBlockType('my-plugin/my-block', { title: 'My Block', edit: () => 'Edit', save: () => 'Save' });
Cwp.blocks.addBlockType('my-plugin/my-block', { title: 'My Block', edit: () => 'Edit' });
Dwp.blocks.createBlock('my-plugin/my-block', { title: 'My Block' });
Attempts:
2 left
💡 Hint
Look for the official function to register blocks in the Gutenberg API.
state_output
advanced
2:00remaining
What is the output when a block's save function returns null?
In a custom Gutenberg block, the save function returns null. What will be the result in the post content?
AThe block will not save any content and will not appear on the front end.
BThe block will save an empty paragraph tag <p></p> in the post content.
CThe block will cause a syntax error and prevent saving the post.
DThe block will save the edit function's output instead.
Attempts:
2 left
💡 Hint
Think about what returning null means for saved content in Gutenberg.
🔧 Debug
advanced
2:00remaining
Why does this block fail to appear in the editor?
You registered a block but it does not show up in the Gutenberg editor. The code is: wp.blocks.registerBlockType('my-plugin/sample-block', { title: 'Sample Block', edit() { return wp.element.createElement('p', null, 'Hello'); } }); What is the likely cause?
Wordpress
wp.blocks.registerBlockType('my-plugin/sample-block', {
  title: 'Sample Block',
  edit() {
    return wp.element.createElement('p', null, 'Hello');
  }
});
AThe block name 'my-plugin/sample-block' is invalid because it lacks a namespace.
BThe block is missing a save function, so it won't appear in the editor.
CThe block is missing the save function, which is required for registration.
DThe edit function uses createElement incorrectly and causes a runtime error.
Attempts:
2 left
💡 Hint
Check if all required properties are present in the block registration.
🧠 Conceptual
expert
3:00remaining
How does the Gutenberg editor handle block serialization?
Which statement best describes how Gutenberg saves block content in the post?
AGutenberg saves blocks as HTML comments wrapping the block's saved HTML output in the post content.
BGutenberg saves blocks as JSON objects inside the post content for easy parsing.
CGutenberg saves blocks as separate files linked from the post content.
DGutenberg saves blocks only in the database metadata, not in the post content.
Attempts:
2 left
💡 Hint
Think about how Gutenberg keeps block boundaries in the post content.