Make WordPress Core

Opened 4 years ago

Closed 15 months ago

#39782 closed defect (bug) (wontfix)

TinyMCE strips empty a href tags breaking code...

Reported by: jkirker Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.2
Component: TinyMCE Keywords:
Focuses: Cc:


TinyMCE is stripping empty a href tags breaking our site.


<a href="http://domain/page/xyz.pdf" class="pdflink"></a> - PDF Document Description

These are also eventually systematically replaced after several reloads.

<a href="http://domain/page/xyz.pdf" class="pdflink">&nbsp;</a> - PDF Document Description
<a href="http://domain/page/xyz.pdf" class="pdflink"><icon></icon></a> - PDF Document Description


Change History (1)

#1 @azaozz
15 months ago

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

Yes, empty inline elements are considered "user errors" and are stripped by default, not just in TinyMCE but most (all?) editors I've seen. They are invisible and "unclickable" on the front-end.

Not sure how you're inserting these <a> tags, but perhaps try padding them with a HTML comment, or an entity. Then they will be considered non-empty (although will still be invisible on the front-end).

This is now superseded by the block editor. Closing as wontfix, feel free to reopen (perhaps with a patch) if this still needs fixing in the classic editor.

Note: See TracTickets for help on using tickets.