Duplicated Page shows something in error

Hi! A user told me today he duplicated a page using a plugin. Then he found the duplicated page showed something wrong on his page.

So, I replicated and saw the same. Why so?

I tried it with the other builders, and they all worked fine.

I am looking forward to hearing from you.
Thank you!

Hi @jornes,

We have used two page/post duplication plugins and they both worked fine with Cwicly blocks.

Which one did you use that resulted in that output?

1 Like

Hello @jornes,

I’m sorry to hear your user is having trouble duplicating pages.
It looks like the plugin in question might be removing the backslash that Gutenberg adds when saving HTML (converted to unicode) to the database.
Could you possibly confirm this is not happening with another non-Cwicly Gutenberg page?

Thanks in advance.

Hi @Louis
I’ve tested a non-Cwicly site with the content in the Gutenberg editor. It worked fine. So, I’m not sure what’s going wrong.


I tested with this Duplicate Page Plugin → Duplicate Page – WordPress plugin | WordPress.org
Test if you see the same.

@jornes, the ones that worked for us in the recent past are:

  1. Yoast Duplicate Post
  2. Duplicate Post Page Menu & Custom Post Type

Depending on your needs, they may or may not be suitable but we have them installed on multiple sites without issue so far.

same issue here. layout broken. old layout gone. i am done… who in the world would expect a duplicate page plugin to destroy a gutenberg page. but yeah. learned my lesson.


Same issue with some duplicate script I’ve been using for years:

Here is the script:

Could it be related to this?

Hello everyone,

This is unfortunately unrelated to Cwicly, but more so how the plugins are duplicating the post/page.

When duplicating, these plugins will be retrieving post_content from the post and simply update the newly created post with the duplicate post content.

The issue here is that Gutenberg transforms to unicode all tags if not in the block HTML → we store our content in attributes for various reasons.
Basically, this requires a simple wp_slash() of the post content to properly process the changes Gutenberg makes.

I highly recommend reaching out to the respective developers as this will concern any Gutenberg plugin that uses attributes to save HTML content.


WOW THANKS @Louis, you nailed it!

I’ve inspected Duplicate Posts plugin from Yoast and they indeed use wp_slash() on post attributes.

So in the custom script I’m using, I’ve replaced:
wp_insert_post( $new_post, true );
wp_insert_post( wp_slash( $new_post ), true );

And it is now working perfectly :heart:
(We just need to regenerate block CSS in Cwicly settings.)