I am looking for a solution to this question about WordPress Blocks. I have a plugin that create a brand new block of an img tag. I would know how to display it in the wp.blocks.registerBlockType function. Thanks in advice!
In the code of the js file I have put this for the result part:
save: function(props) {
return wp.element.createElement(
'img', {src: "https://api.nasa.gov/assets/img/general/apod.jpg"}
);
}
It's not correct. WordPress display the Attempt Recovery message. What is wrong with it?
I found the problem with it!
The
wp.blocks.registerBlockTypeneeds title, icon, category, attributes and an edit function before the save function.The correct code is here: