WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#42971 closed defect (bug) (worksforme)

Page editor (TinyMCE) strips preformatted code entered inside <pre><code> tags.

Reported by: Sakis Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.1
Component: TinyMCE Keywords:
Focuses: Cc:

Description

Edit some page or post
Switch editor to text
Enter the following snippet

<pre>
<code>
/* Just for testing purposes */

#include <stdio.h>

main()
{
    printf("Hello World");
}
</code>
</pre>

Save, publish or switch to visual
Voila, "<stdio.h>" part is stripped out from both visual editor and page when rendered.

PS: Tested with clean installed WP, no plugins or third party themes, with Chrome, Edge and Safari browsers in Win10 and MacOS X

Change History (1)

#1 @azaozz
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Hi @Sakis, don't think this is a bug. In the Text editor you are in HTML context, i.e. you can type HTML tags, attributes, etc. Generally the <, >, and & characters should be encoded to HTML entities.

Version 0, edited 2 years ago by azaozz (next)
Note: See TracTickets for help on using tickets.