Recall & Review
beginner
What is a custom meta box in WordPress?
A custom meta box is a section added to the WordPress post editor screen where you can add extra fields or controls to collect additional information about a post.
Click to reveal answer
beginner
Which WordPress hook is used to add custom meta boxes?
The
add_meta_boxes hook is used to register and add custom meta boxes to the post editor screen.Click to reveal answer
intermediate
What function is used to create the content inside a custom meta box?
You create a callback function that outputs the HTML for the meta box content. This function is passed as a parameter to
add_meta_box().Click to reveal answer
intermediate
How do you save data entered in a custom meta box?
You hook into
save_post action and use update_post_meta() to save the meta box data securely when the post is saved.Click to reveal answer
intermediate
Why should you use
wp_nonce_field() in custom meta boxes?Using
wp_nonce_field() adds a security token to your meta box form to protect against unauthorized form submissions (CSRF attacks).Click to reveal answer
Which function registers a custom meta box in WordPress?
✗ Incorrect
add_meta_box() is the correct function to register a custom meta box.Where do custom meta boxes appear in WordPress?
✗ Incorrect
Custom meta boxes appear on the post editor screen to add extra fields.
Which hook should you use to save meta box data?
✗ Incorrect
The
save_post hook runs when a post is saved, perfect for saving meta box data.What is the purpose of
wp_nonce_field() in meta boxes?✗ Incorrect
wp_nonce_field() adds a security token to protect against unauthorized submissions.Which parameter of
add_meta_box() defines the callback function for the meta box content?✗ Incorrect
The third parameter of
add_meta_box() is the callback function that outputs the meta box HTML.Explain how to add a custom meta box to a WordPress post editor screen and save its data.
Think about the steps from showing the box to saving the input.
You got /6 concepts.
Why is it important to use nonces when working with custom meta boxes in WordPress?
Consider what could happen if anyone could submit the form.
You got /4 concepts.