Skip to content

Auto p corrupting paragraph blocks. #64353

@nbcsteveb

Description

@nbcsteveb

Description

If I save an article such as:

wp_insert_post(['post_content'=>'<!-- wp:paragraph --><p dir="ltr">Hello, world!</p><! -- /wp:paragraph -->']);

When you open the article and save as draft, this function (or something around it) is updating this content to:

<!-- wp:paragraph -->
<p><p dir="ltr">Hello, world!</p></p>
<!-- /wp:paragraph -->

Which Gutenberg then tells the user is an invalid block of content:

image

And when resolving:
image

Step-by-step reproduction instructions

  1. Save article: wp_insert_post(['post_content'=>'<!-- wp:paragraph --><p dir="ltr">Hello, world!</p><! -- /wp:paragraph -->']);
  2. Open article in WP and save as draft.
  3. Refresh the page.
  4. Notice the warning about invalid content.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TestingNeeds further testing to be confirmed.[Status] Needs More InfoFollow-up required in order to be actionable.[Status] StaleGives the original author opportunity to update before closing. Can be reopened as needed.[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions