Custom Link


Add a page, link, or another item to your navigation.

  • Name: core/navigation-link
  • Category: design
  • API Version: 3
  • Block Type: Hybrid (static save + server enhancements)

Block Relationships

Parent blocks (direct):
core/navigation

Allowed inner blocks:
core/navigation-link
core/navigation-submenu
core/page-list

Attributes

Defined via the attributes property in block.json.

Attribute Type Default Description
label string Role: content
type string
description string
rel string
id number
opensInNewTab boolean false
url string Role: content
title string
kind string
isTopLevelLink boolean

Supports

Defined via the supports property in block.json.

Context

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

Uses context:

  • textColor
  • customTextColor
  • backgroundColor
  • customBackgroundColor
  • overlayTextColor
  • customOverlayTextColor
  • overlayBackgroundColor
  • customOverlayBackgroundColor
  • fontSize
  • customFontSize
  • showSubmenuIcon
  • maxNestingLevel
  • style

CSS Selectors

Defined via the selectors property in block.json.

  • states:
    • -current: .wp-block-navigation .current-menu-item

Block Markup

This is a hybrid block. It saves static markup that the server may enhance during rendering.

<!-- wp:navigation-link {"label":"WordPress","url":"https://wordpress.org/"} -->
<!-- /wp:navigation-link -->

Source