Closed helgatheviking closed 6 months ago
This seems to be the issue with shell rather than WP CLI. Even echo "<!-- wp:paragraph --><p>PIZZA FRIDAY</p><!-- /wp:paragraph -->"
gives that error. !
character is expected to be escaped. When you escape such character in the command, it works as expected.
wp post create --post_title="Pizza Day" --post_status=publish --post_content="<\!-- wp:paragraph --><p>PIZZA FRIDAY</p><\!-- /wp:paragraph -->"
I just tested your command in the CLI and it runs without error, however the content created is still not a block but the classic content. The escaped comment is still considered a string.
Found [this issue] which suggests importing escaped content via HTML file. don't know if I'll be able to do that in the blueprint.json, but I will try to test.
Above command is working fine for me. I am using WP-CLI 2.10.0
.
Let's continue the conversation in https://github.com/wp-cli/wp-cli/issues/5923#issuecomment-2040069624
Bug Report
Describe the current, buggy behavior
Cannot add block content via the
--post_content
flag.Describe how other contributors can replicate this bug
Try to create a post with block content
See error that the event is not found.
However
inserts a post, though with "classic editor" content that then needs to be converted to blocks.
Hopefully this is just bad formatting on my part? In which case, we can switch this to a documentation request?
Describe what you would expect as the correct outcome
post inserted with block content ready for use in the block editor
Let us know what environment you are running this on