Blog Sections Open

Fixing TinyMCE When It Starts Inserting 4p> Instead of Paragraph Tags

How to reason about strange TinyMCE output corruption when paragraph tags are replaced with broken markup fragments.

When TinyMCE suddenly starts inserting something like 4p> instead of a normal paragraph tag, the editor is telling you that the content pipeline has been corrupted somewhere between editor configuration, encoding, and output filtering.

This kind of bug usually appears after an update or after another plugin starts altering the editor output unexpectedly.

Where to investigate

  • recent editor updates,
  • custom TinyMCE plugins or toolbar changes,
  • encoding issues in the manager or language files,
  • filters that mutate HTML before save or before display.

Because the inserted fragment resembles broken HTML, the safest assumption is that something in the editor stack is rewriting tag text incorrectly, not that the content author suddenly did something wrong.

Odd editor corruption bugs are almost always easier to solve by disabling extensions and testing a minimal config first.

Newer post

Fixing Tree Editing Bugs When pagetitle Contains Quotes

Why quoted page titles can break resource editing in the document tree and what to audit in the manager-side escaping logic.

Older post

Fixing KCFinder File Links That Resolve to undefined/files/

Why TinyMCE and KCFinder can generate broken file URLs like undefined/files and what path assumption is usually wrong.