Guest User

Untitled

a guest
Jan 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2. /**
  3. 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?
  4.  
  5. I didn't test this!
  6. */
  7. $block = new WP_Block_Type('zg/block',
  8. [
  9. 'attributes' => [
  10. 'hi' => [
  11. 'type' => 'string',
  12. 'default' => get_option( 'hi', 'roy' )
  13. ]
  14. ]
  15. ]
  16. );
  17. WP_Block_Type_Registry::get_instance()->register($block );
Add Comment
Please, Sign In to add comment