3

I want to run some JavaScript when a user uploads an image or images using the core/image block or core/gallery block. Ideally I would run my own code when the onSelectImage function is called (and the equivalent for core/gallery). I've looked at hooks in Gutenberg but it seems that they're only available in a small number of places, and there are none directly for the core/image or core/gallery blocks.

I know the developers intend to make it easy to apply actions and filters in Gutenberg, but I'm not sure if they just haven't added any hooks/filters for the core/image block yet or if it's already possible but I'm not seeing how to do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.