WordPress / developer-blog-content

In this GitHub space, WordPress team coordinates content to be published on the Developer Blog. Discussions and montly meetings (first Thu - 13:00 UTC) in WP Slack #core-dev-blog
https://developer.wordpress.org/news
40 stars 5 forks source link

Snippet: How to filter the output of a Block Binding #345

Open bph opened 1 week ago

bph commented 1 week ago

Discussed in https://github.com/WordPress/developer-blog-content/discussions/341

Originally posted by **ndiego** November 18, 2024 This snippet would show developers how to use the `get_value_callback` property of the [`register_block_bindings_source()`](https://developer.wordpress.org/reference/functions/register_block_bindings_source/) function and the [`block_bindings_source_value`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-bindings/#server-registration) filter to modify the output of a Block Binding on the front end. This snippet will provide a solution for implementations like this: ![image](https://github.com/user-attachments/assets/429cac7d-16e0-4cba-b489-9bbf02dd7c1b)