awesomemotive / one-click-demo-import

One Click Demo Import plugin
https://www.awesomemotive.com/
195 stars 84 forks source link

Gutenberg blocks are not imported properly #206

Closed themeperch closed 4 years ago

themeperch commented 4 years ago

Atfirst thanks for sharing a great plugin. I am using this plugin for a long time. But nowadays I've got a major issues, gutenberg blocks are not imported properly.

Once I use default WordPress Importer, everything are imported successfully.

Is it possible to looking into this. Thanks for reading

gtusr11 commented 4 years ago

Hello,

Fix is in this pull request: https://github.com/proteusthemes/WordPress-Importer/pull/3

It was also mentioned here: https://github.com/awesomemotive/one-click-demo-import/issues/179

Details: In content created with Gutenberg editor, some characters (used in block attribute) are encoded into unicode character codes that start with a backslash, e.g.

<!-- wp:plugin/custom-block {"data":"Some text and \u003ca href=\u0022https://example.com/\u0022\u003esome-link\u003c/a\u003e."} /-->

Before inserting into database, wp_insert_post() function runs the post object through wp_unslash() function which strips all backslashes. This breaks unicode character codes (and content). To mitigate that, we should run the post object through wp_slash() functions before passing it to wp_insert_post(). The original WordPress Importer does this.

capuderg commented 4 years ago

The post and post meta data is now properly escaped with wp_slash.

This will be shipped in the next plugin update.

Fixed in https://github.com/awesomemotive/one-click-demo-import/commit/d34c23c9597d7d956f24007f22d8a83bbbe37a96

capuderg commented 4 years ago

The plugin was just updated (v2.6.0).

Could you please check if this issue is now resolved?

Thank you and have a nice day!