Block Bindings (WordPress 6.5+)

  • JNext lesson
  • KPrevious lesson
  • FSearch lessons
  • EscClear search

The plugin registers a block bindings source (dmyip/date) that allows core blocks (Paragraph, Heading, Button, etc.) to display dynamic dates without shortcodes or custom blocks.

Block bindings let core blocks display dynamic dates without shortcodes: the dmyip/date source binds a Paragraph or Heading’s content to a live date value, the modern WordPress 6.5+ way to do what shortcodes have done since 2010.


How It Works

Block Bindings let you connect a core block’s content to a dynamic data source. Instead of typing [year] in a Paragraph block, you bind the paragraph’s content to the dmyip/date source with type: "year". The output is rendered server-side with no shortcode processing needed.


Available Types

year, nyear, pyear, month, month_short, nmonth, pmonth, date, monthyear, day, weekday, weekday_short, published, modified, blackfriday, cybermonday, daysuntil, dayssince


Parameters

Some types accept additional parameters:

  • year: offset (int) → {"type": "year", "offset": 5} → 2031
  • daysuntil: date (YYYY-MM-DD) → {"type": "daysuntil", "date": "2026-12-25"} → 310
  • dayssince: date (YYYY-MM-DD) → {"type": "dayssince", "date": "2020-01-01"} → 2240

Block Markup Examples

Current Year in a Paragraph

<!-- wp:paragraph {
    "metadata": {
        "bindings": {
            "content": {
                "source": "dmyip/date",
                "args": {
                    "type": "year"
                }
            }
        }
    }
} -->
<p></p>
<!-- /wp:paragraph -->

Next Year in a Heading

<!-- wp:heading {
    "metadata": {
        "bindings": {
            "content": {
                "source": "dmyip/date",
                "args": {
                    "type": "nyear"
                }
            }
        }
    }
} -->
<h2></h2>
<!-- /wp:heading -->

Days Until Christmas

<!-- wp:paragraph {
    "metadata": {
        "bindings": {
            "content": {
                "source": "dmyip/date",
                "args": {
                    "type": "daysuntil",
                    "date": "2026-12-25"
                }
            }
        }
    }
} -->
<p></p>
<!-- /wp:paragraph -->

Year with Offset

<!-- wp:paragraph {
    "metadata": {
        "bindings": {
            "content": {
                "source": "dmyip/date",
                "args": {
                    "type": "year",
                    "offset": 5
                }
            }
        }
    }
} -->
<p></p>
<!-- /wp:paragraph -->

When to Use Block Bindings vs Shortcodes

  • Dynamic date inside a sentence: Shortcode (Best of [year])
  • Entire block content is a date: Block Binding
  • Theme templates: Block Binding
  • Headless/decoupled sites: Block Binding (no shortcode parsing needed)
  • Legacy content: Shortcode (backward compatible)
  • SEO meta fields: Shortcode (SEO plugins process shortcodes)

Quick answers to common questions:

Why use block bindings instead of a shortcode?

Bindings keep content structured: the block knows it displays a dynamic value, the editor shows it cleanly, and there’s no shortcode text to break during copy-paste. For new block-based sites, bindings are the cleaner architecture.

Which blocks support the dmyip/date binding?

The core blocks WordPress allows bindings on: Paragraph, Heading, Button, and Image attributes. Bind the content attribute to dmyip/date with your format args and the block renders the live value.