,

Adding Custom Fields (Attributes) to Core Blocks

Using just three filters, we’ll add a few custom fields to the core “Button” block in WordPress that will update the button’s content on the front end. We’ll use a little bit of JavaScript, including WordPress/scripts and WordPress/components, as well as the new WP_HTML_Tag_Processor class in PHP.

👉 Code: https://github.com/bacoords/example-query-loop-button
👉 Block Filters: https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/
👉 SlotFill: https://developer.wordpress.org/block-editor/reference-guides/components/slot-fill/
👉 Gutenberg Storybook: https://wordpress.github.io/gutenberg/?path=/docs/docs-introduction–page

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.