I have added some iframe with a map, in some pages, the problem is that the map is not visible in most of them. Only on the first page the map is shown, on all other pages it is not., when I enter to edit the content I get this message "This block contains unexpected or invalid content. Attempt Block Recovery" When pressing the "Attempt Block Recover" button, the map is visible again, but when updating, the same problem happen again.
<div data-mapid="_2ee294-cb"><iframe width="100%" height="100%" style="border:0" loading="lazy" src="https://www.google.com/maps/embed/v1/place?key=KADENCE_GOOGLE_MAPS_KEY&zoom=11&maptype=roadmap&q=Bachus & Schanker 102 S Tejon St 11th floor, Colorado Springs, CO 80903"></iframe></div>
Does anyone with the same problem know if it is a problem of the map or wordpress?
CodePudding user response:
Sometimes there is a problem with saving the posts using unexpected elements in Gutenberg.
I got the same message when using the "Update" button to save changes, after doing the block recovery. Next time I edited the post, there was again the message.
I got a working stopgap solution, using "Cmd S" on the keyword for saving the post after doing the block recovery, and NOT clicking the "update" button.
This is just a work around, but this way I got things going with an element I wasn't allowed to remove or replace in Gutenberg editor, so I wanted to prevent the block from causing an error. Worked in my case.
Other suggestions:
- Have you replaced the key in your iframe src with an existing key (" KADENCE_GOOGLE_MAPS_KEY" is just a placeholder) ? You should use a valid key.
- Have you tried giving the iframe specific size like
width="500" height="500"
? Iframe sizes should at least have a pixel based height. - Have you tried using another iframe src just for testing, if it has to do with google maps? This way you will find out what causes the problem.
CodePudding user response:
I had a plugin that was affecting the iframe, an optimization plugin, that was the problem.