跳转到主要内容

Social Icon

The Social Icon is a foundational block that displays various icons linking to different social profiles or sites. Each social service is registered as a variation of this block.

Adding new social icons

The core maintains certain standards for adding new social icons. To add a new variation to WordPress, it must be well-established and popular.

To evaluate if a social service should be added, contributors will consider the following factors:

  • Is the service popular enough for core developers to have heard of it before? Is it “mainstream?”
  • How long has the service been online?
  • Does it have a Wikipedia article?
  • Is there a plugin adding social icons in the repository that includes the services in question and has a considerable number of active installations?
  • Is this social service frequently requested?

Adding custom social icons

Starting from WordPress 6.9, it’s possible to add custom social icons to your site. See:

  • Name: core/social-link
  • Category: widgets
  • API Version: 3
  • Block Type: Dynamic (server-rendered)

Block Relationships

Parent blocks (direct):
– core/social-links

Attributes

Defined via the attributes property in block.json.

Attribute Type Default Description
url string — Role: content
service string — —
label string — Role: content
rel string — —

Supports

Defined via the supports property in block.json.

Context

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

Uses context:

  • openInNewTab
  • showLabels
  • iconColor
  • iconColorValue
  • iconBackgroundColor
  • iconBackgroundColorValue

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:

Source