0

This is a paragraph and a hr-separator in html:

<p>Test</p>
<hr/>

This is what happens when I create it in the visual editor:

<!-- wp:paragraph -->
<p>Test</p>
<!-- /wp:paragraph -->

<!-- wp:separator -->
<hr class="wp-block-separator has-alpha-channel-opacity"/>
<!-- /wp:separator -->

Yeah, my paragraph started and endend, thanks for clarifying my p-tags. What use have those comments? Can I somehow disable the creation of them? Lets give the paragraph some styling:

<p class="has-text-align-center has-secondary-color">Test</p>

This is what the visual editor does:

<!-- wp:paragraph {"align":"center","style":{"elements":{"link":{"color":
{"text":"var:preset|color|secondary"}}}},"textColor":"secondary"} -->
<p class="has-text-align-center has-secondary-color has-text-color
has-link-color">Test</p>
<!-- /wp:paragraph -->

If I remove this crap, it looks completely the same. So what is the point? Can someone from a technical perspective explain why wordpress is bloating my html with json-data-commentaries instead of just having a clean html/css style binding? Why is the editor storing data in commentaries instead of parsing them from the html it just wrote in the first place, where all this data is already stored in classes?

This sounds like a rant and partly it is, but I really try to understand the technical reasoning behind it.

2
  • 2
    If you want to get rid of then, don't use WordPress. Try another CRM. Those tags that you want to get rid of, are the core of the block system of WordPress as I have already pointed on your other question.
    – Iogui
    Commented Aug 3 at 18:20
  • 2
    I don't think they're useless comments, I think what you're referring to is how the block editor works. Commented Aug 5 at 2:06

2 Answers 2

2

The block editor is a hideous abortion but it's here to stay. Your only recourse if you don't like the way it operates is to use a plugin that replaces it altogether. Attempting to manually edit the mess it generates will break things. Attempting to manually write HTML outside of an HTML block will break things.

1
  • I just switched to ClassicPress. I was short of "ok, im gonna code a CMS myself", but gladly, I'm not the only one not understanding how someone can willingly implement such a premium-crap.
    – rhavin
    Commented Aug 8 at 10:06
1
  1. Switch to code view and manually delete the comments
  2. Use a plugin or extension that removes HTML comments.
  3. Check the editor's settings for an option to disable these comments.
1
  • 1
    Deleting them will break the block editor. As a general rule it's not a good idea to advise people to delete things that they don't fully understand.
    – Chris Cox
    Commented Aug 6 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.