Bird
0
0

Which of the following is the correct way to define a block attribute named title of type string in a block's attributes object?

easy📝 Syntax Q12 of 15
Wordpress - Shortcodes and Blocks
Which of the following is the correct way to define a block attribute named title of type string in a block's attributes object?
A"title": { type: String }
B"title": "string"
C"title": { value: "string" }
D"title": { type: "string" }
Step-by-Step Solution
Solution:
  1. Step 1: Recall attribute syntax in block.json or registerBlockType

    Attributes are defined as objects with a type property as a lowercase string. Compare options: \"title\": { type: \"string\" } uses { type: \"string\" } which is correct. \"title\": { type: String } uses String (capitalized) which is invalid.
  2. Final Answer:

    \"title\": { type: \"string\" } -> Option D
  3. Quick Check:

    Attribute type uses lowercase string \"string\" [OK]
Quick Trick: Use { type: \"string\" } with lowercase type name [OK]
Common Mistakes:
  • Using capitalized String instead of \"string\"
  • Assigning attribute directly to a string
  • Using incorrect property like value instead of type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes