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 comments are not being stripped from article content #949

Closed
HaripriyaHari opened this issue Apr 20, 2020 · 1 comment
Closed
Labels
bug Something isn't working [P: HIGH]
Milestone

Comments

@HaripriyaHari
Copy link

Article” type not stripping out things like

Reference: https://wordpress.org/support/topic/how-to-remove-comments-from-json-data/

@winstonleedev
Copy link

Hello, thanks for checking this out.

I tried to remove the comments by doing a regular expression search like the following in function.php, line 347

                    // Strip out gutenberg comments from mainEntityOfPage
                    $gutenberg_comments_pattern = '/<!--\s+(\/)?wp:[a-z\-]+(\s+(\{.*?\}))?\s+-->/';
                    $no_comments_webpage = preg_replace($gutenberg_comments_pattern, "", $webpage['@id']);

                    $output['mainEntityOfPage'] = $no_comments_webpage;

I tested the code elsewhere and it seemed to work, but not with the plugin. can you prove some sample output of $webpage['@id'] or provide some pointers? :)

@Sanjeevsetu Sanjeevsetu added this to the 1.9.35 milestone Apr 25, 2020
@Sanjeevsetu Sanjeevsetu added [P: HIGH] bug Something isn't working labels Apr 25, 2020
Sanjeevsetu added a commit that referenced this issue Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working [P: HIGH]
Projects
None yet
Development

No branches or pull requests

3 participants