How do I modify a core block, in my case gallery block to add extra markup to can fire some lightbox on created gallery. Is there a way to hook in on render of gallery on frontpage to adjust markup?

1 Answer 1


You need to use Block Filters to modify existing blocks. There are couple of handy hooks you need to use in place of edit and save function to wrap around core blocks into your desirable block structure.

For your purpose I guess, you need to use - blocks.getSaveElement and editor.BlockEdit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.