Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent backslashes from being stripped on post insertion #172

Closed
wants to merge 1 commit into from

Commits on Jul 3, 2020

  1. Prevent backslashes from being stripped on post insertion

    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.
    gtuser10 authored Jul 3, 2020
    Configuration menu
    Copy the full SHA
    13222d8 View commit details
    Browse the repository at this point in the history