Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- I think this sets block attribute from get_option() I don't see how to get value from DOM to update_option() Is there a pre save hook for block attrs?
- I didn't test this!
- */
- $block = new WP_Block_Type('zg/block',
- [
- 'attributes' => [
- 'hi' => [
- 'type' => 'string',
- 'default' => get_option( 'hi', 'roy' )
- ]
- ]
- ]
- );
- WP_Block_Type_Registry::get_instance()->register($block );
Add Comment
Please, Sign In to add comment