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.


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:

  • yearoffset (int) → {"type": "year", "offset": 5} → 2031
  • daysuntildate (YYYY-MM-DD) → {"type": "daysuntil", "date": "2026-12-25"} → 310
  • dayssincedate (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)