WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 4 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:
PR Number:

Description

TinyMCE is stripping empty a href tags breaking our site.

IE:

<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

etc.

Change History (1)

#1 @azaozz
4 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.