Make WordPress Core

Opened 5 years ago

Last modified 4 years ago

#45829 new defect (bug)

New editor replaces > with &gt; within <pre> tag

Reported by: yannsalmon's profile yannsalmon Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 5.0.2
Component: Editor Keywords: dev-feedback needs-patch
Focuses: javascript Cc:


I just updated to WordPress 5 and started using the new block editor.

I typeset source code in my posts using a <pre> tag. This code contains a > comparison operator. Upon saving my draft, > gets replaced with &gt;, and this entity is also displayed in the article preview.

This happens even if I disable the visual editor.

The old editor does not present this bug and installing the Classic Editor extension allowed me to work around this.

Change History (2)

#1 @subrataemfluence
5 years ago

  • Focuses javascript added
  • Keywords dev-feedback needs-patch added

You are right!

Actually the behavior is quite strange. I have the following code:


When I look into HTML it turns to


Not all < are converted to &lt; <br>, <p> and </p> all are fine.
For hand written HTML tags like pre and div, > are not converted to &gt;.

It looks like default HTML tags rendered by Gutenberg are fine. The strange behavior starts with HTML tags we write by hand!

Last edited 5 years ago by subrataemfluence (previous) (diff)

#2 @andraganescu
4 years ago

Hi @subrataemfluence , how did you make the editor do it, step by step? Inserting the HTML you provided in an HTML block does leave it intact.

Note: See TracTickets for help on using tickets.