Cleaning <!– wp:* comment elements from the WordPress Gutenberg editor
Posted by jpluimers on 2026/11/05
The only reason the very keyboard unfriendly WordPress Gutenberg editor can be a block editor is that it inserts tons of HTML comment elements starting with <!-- wp: in the code like for instance <!-- wp:paragraph -->…<!-- /wp:paragraph -->.
That makes the HTML even heavier than it already is, and getting rid of it wasn’t easy to find but is easy to do.
I wanted a JavaScript based solution, but could not find any quickly enough so for now these website based solutions work OK-ish when enabling the “clean comments” checkbox and then perform a clean action:
- Website: [Wayback/Archive] HTML Cleaner – Online Beautifyer and Word Converter
- Website: [Wayback/Archive] Clean HTML Code Cleaner | Remove Unwanted Styles & Tags
More links:
- Website: [Wayback/Archive] How to automatically cleanup & format a huge, messy block of HTML? : HTML
- PHP: [Wayback/Archive] Getting clean HTML out of Gutenberg without pain : WordPress
- PHP: [Wayback/Archive] editor – Remove html markup by wordpress – WordPress Development Stack Exchange
- PHP: [Wayback/Archive] Remove in WordPress – Stack Overflow
- PHP: [Wayback/Archive] php – Outputting post content to jQuery .html() string – WordPress Development Stack Exchange
- [Wayback/Archive] @wordpress/block-serialization-default-parser – Block Editor Handbook | Developer.WordPress.org
- [Wayback/Archive] GitHub – front/gutenberg-js: JavaScript only version of the WordPress Gutenberg editor (DEPRECATED) · GitHub
WordPress users seem madly in love with PHP, but that is really hard to implement client side and impossible server side unless your WordPress.com account is really expensive. In the above list, JavaScript solutions that are far easier to run client-side are regrettably absent and even the below queries didn’t find them.
Oh, finding back these Gutenberg posts on my blog was easy: https://wiert.me/wp-admin/edit.php?s=wp:paragraph
Queries:
- [Archive] html cleanup – Google Search
- [Wayback/Archive] html cleanup at DuckDuckGo
- [Wayback/Archive] html remove “wp:paragraph” at DuckDuckGo
- [Wayback/Archive] JavaScript html remove “wp:paragraph” Gutenberg at DuckDuckGo
--jeroen
Share this:
- Share on Mastodon (Opens in new window) Mastodon
- Share on Bluesky (Opens in new window) Bluesky
- Share on Tumblr
- Share on Reddit (Opens in new window) Reddit
- Share on Threads (Opens in new window) Threads
- Tweet
- Share on Telegram (Opens in new window) Telegram
- Share on Nextdoor (Opens in new window) Nextdoor
- Share on WhatsApp (Opens in new window) WhatsApp
- Print (Opens in new window) Print
- Email a link to a friend (Opens in new window) Email
Related
This entry was posted on 2026/11/05 at 18:00 and is filed under Classic editor, Development, Gutenberg editor, HTML, SocialMedia, Software Development, Web Development, WordPress, WordPress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.






Leave a Comment