JavaScript for WordPress Forums Gutenberg Development How to handle Custom Block template updates Reply To: How to handle Custom Block template updates

#40050
hallme
Participant

@rosswintle I’ve not tried it, but I believe the shortcode could work. I gave that example as a question on how to build and maintain a custom block, less on how to update the existing update (also an important question, though.)

After reading a pretty great blog post on how Human Made set up their homepage in Gutenberg, I went back and re-watched the dynamic block videos. I had been expecting to build the block interior with JSX and the REST API in the save function, but it seems like the preferred method is to use a PHP callback. Zac mentions in the Alt Dynamic Block video that there may be a way of doing everything in JS, but it has not established itself as a “standard” yet.

I’ve tested this, and found that by editing the PHP function, the front end of the block will update automatically. This solves most of my concerns about the viability of custom blocks, but it does not immediately solve for block data migration or wrapper name updates.