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

Gutenberg issue: rich text area content get malformated #754

Open
Abouhassane opened this issue Apr 27, 2021 · 1 comment
Open

Gutenberg issue: rich text area content get malformated #754

Abouhassane opened this issue Apr 27, 2021 · 1 comment
Labels
type:enhancement New feature or request.
Milestone

Comments

@Abouhassane
Copy link

Abouhassane commented Apr 27, 2021

Hello,

Lately i got the chance to work on a multi-site WordPress installation and i used GUTENBERG to develop most of the site blocks.

The other sites are a basically a replica of the main site with the need to propagate each change of the principal site on all the other sites. Where came the need to use DISTRIBUTOR which was a bless.

The only issue with GUTENBERG/DISTRIBUTOR is for blocks that contain rich-text areas got there content malformed, probably because they contain HTML.

After a bit of research, we found two useful hooks to resolve this issue. I take this chance to share with you the solution:

  • Insert the following code in functions.php:

    // Use a filter to format the content
    add_filter('dt_pull_post_args', 'distributorFilter');
    add_filter('dt_push_post_args', 'distributorFilter');
    function distributorFilter($post_array)
    {
       $post_array['post_content'] = str_replace('\\', '\\\\', $post_array['post_content']);
       return $post_array;
    }

@Abouhassane Abouhassane added the type:enhancement New feature or request. label Apr 27, 2021
@jeffpaul jeffpaul added this to the 2.1.0 milestone Apr 28, 2021
@jeffpaul
Copy link
Member

@Abouhassane welcome to Distributor and thanks for the feedback! We're working on a related issue, #430, though it's a couple releases out on the roadmap but we will certainly include your input as we get closer to being ready to work on these issues... thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants