I have exactly the same issue, my content is in several blocks in a row layout. When I go on the edit page, all blocks are hided, only one block is showing βThis block contains unexpected or invalid content.β, and if I do anything (resolve, convert to HTML or classic), I lose all my blocks and get only the last one, containing a shortcode.
In looking at the revisions, I saw that the “uniqueID” seems to change when the bloc show this errors.
[EDIT] After a few investigations, this error seems to appear repeatedly when adding a shortcode in a classic block. In using a shortcode block, it seems to be OK (for now).
-
This reply was modified 7 years, 2 months ago by
Aveias.
Thread Starter
Rick
(@murlyn)
What is the proper way of using a shortcode, especially one that has a start and end block, like [box][/box] with HTML and formatting in between that shortcode? The regular shortcode block doesn’t allow for formatting and if the classic block and the row layout is having issues with it.. how do you get around it?
Hey,
Thanks for posting, I’m not having this happen to me when I test. Could you tell me what version of WordPress and Kadence Blocks you are using? Any other variables I should know about to recreate?
I tried with one and multiple shortcodes in the classic editor block.
Ben
Can you share exactly what you’re placing within the shortcode block so that I can test on my site?
-Kevin
Thread Starter
Rick
(@murlyn)
It’s a theme specific shortcode, but here you go:
[box]Just a whole bunch of stuff[/box]
Now I think I might see the problem and it might not be a row layout issue. I looked at the code and there will be improperly nested code:
<div kadence inner column><p>[box]Just a whole bunch of stuff</p><p>another test[/box]</p></div>
so basically parsed
<div kadence inner-col><p><div box>whole bunch of stuff</p><p>more stuff</div></p></div>
So hmm.. yeah it looks like it’s not going to like this at all… and from what I can tell it’s a theme shortcode issue not really made for this new version of WordPress. I was converting the page to use blocks, which was fine and then row layout is just what highlighted that there was an issue.. Im not going to close this issue as resolved since there are other people having similar problems.. might even be the same.. Ill continue monitoring though π
Thanks for posting,
If your shortcode is adding posts using something like the_excerpt then it’s a known issue: https://github.com/WordPress/gutenberg/issues/12530
Let me know if you discover anything further.
Ben
Thread Starter
Rick
(@murlyn)
No nothing like that, it just adds a div around the content:
[box]This is the shortcode[/box]
<div class="box shortcode-box">This is the parsed shortcode</div>
So if the content is this:
[box]This is the shortcode
Yep this is what it is.[/box]
Then it renders as this:
<p><div class="box shortcode-box">This is the shortcode</p>
<p>Yep this is what it is.</div></p>
Which isn’t nested correctly.. this is my running theory at this point π
yeah, it’s possible that shortcode is running autowrap on the content which in Gutenberg would break things.