# Bind Blocks to Site Details (Block Bindings)

> Registers a Block Bindings source so Paragraph, Heading and Button blocks can display the site name, tagline, URL or current year and stay up to date automatically.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: block-bindings, blocks, site-name
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/site-details-block-bindings/

## Code

```php
add_action( 'init', function () {
    if ( ! function_exists( 'register_block_bindings_source' ) ) {
        return;
    }

    register_block_bindings_source( 'wpide/site-details', array(
        'label'              => 'Site details',
        'get_value_callback' => function ( $source_args ) {
            $key = isset( $source_args['key'] ) ? $source_args['key'] : '';

            switch ( $key ) {
                case 'name':
                    return esc_html( get_bloginfo( 'name' ) );
                case 'tagline':
                    return esc_html( get_bloginfo( 'description' ) );
                case 'url':
                    return esc_url( home_url( '/' ) );
                case 'year':
                    return esc_html( wp_date( 'Y' ) );
            }

            return null;
        },
    ) );
} );
```

## Notes

Requires WordPress 6.5 or newer. In the code editor use for example {"metadata":{"bindings":{"content":{"source":"wpide/site-details","args":{"key":"year"}}}}} on a Paragraph block. Keys are name, tagline, url and year.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Bind Blocks to Site Details (Block Bindings)" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
