WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.47k stars 4.18k forks source link

Update `wp_insert_post()` to support FSE+ #53604

Open Sam-Xronn opened 1 year ago

Sam-Xronn commented 1 year ago

What problem does this address?

Currently its incredibly difficult to pass valid core block markup to wp_insert_post() making it tricky to dynamically inject content into websites using the FSE. Typically I've found valid block markup from PHP files assigned to the post_content parameter is converted into the "classic editor" block.

What is your proposed solution?

Ideally update wp_insert_post() and wp_update_post to be able to pass FSE template parts, or full templates. These can then be designed within FSE and passed to these hooks.

carlomanf commented 1 year ago

Thanks for the report. Can you provide an example post content string that gets parsed incorrectly?

carolinan commented 1 year ago

Template parts are not supported in the block editor; I have had no issues including block patterns, if that helps.