Avatar


Add a user’s avatar.

  • Name: core/avatar
  • Category: theme
  • API Version: 3
  • Block Type: Dynamic (server-rendered)

Attributes

Defined via the attributes property in block.json.

Attribute Type Default Description
userId number
size number 96
isLink boolean false
linkTarget string "_self"

Supports

Defined via the supports property in block.json.

Context

Defined via the usesContext and providesContext properties in block.json.

Uses context:

  • postType
  • postId
  • commentId

CSS Selectors

Defined via the selectors property in block.json.

  • border: .wp-block-avatar img
  • filter:
    • duotone: .wp-block-avatar img

Block Markup

This is a dynamic block. It is rendered on the server and does not save HTML in post content.

In post content, it is stored as a block comment:

<!-- wp:avatar {"userId":4, "size":85,"isLink":true,"align":"right","style":{"spacing":{"margin":{"bottom":"40px"}},"border":{"radius":"47px","width":"3px"},"color":{"duotone":["#000000","#ffe2c7"]}},"borderColor":"vivid-red"} /-->

Source