Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#42003 closed defect (bug) (duplicate)

TinyMCE views add <p> tags around shortcodes when switching from Visual to Text/HTML editor

Reported by: lvl99's profile lvl99 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9
Component: Editor Keywords:
Focuses: ui, javascript Cc:


I'm using the Shortcake plugin to manage an admin interface for creating and modifying shortcode content.

Shortcodes which are managed by Shortcake use the WordPress TinyMCE View plugin to render the shortcode in the editor.

When switching from the Visual to the Text/HTML editor (and even when saving posts) all shortcodes which have TinyMCE views then have extra newlines inserted around them. In the case of shortcodes which are used in inline positions (i.e. within a header tag) this then adds extra paragraphs and breaks the content.

I've found that this is all due to one line which inserts <p> tags around the shortcode text:

I feel that the TinyMCE View should be able to support both block and inline elements. I found in my exploration that removing the <p> tags solved my issue, however I'm not sure what any residual issue from removing the extra tags may have caused. It'd be great to get some others' opinions on it.

Change History (1)

#1 @adamsilverstein
7 years ago

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

Hi @lvl99 - welcome to Trac and thanks for the bug report.

This seems to be a duplicate of this issue: #6984 and a slew other related tickets including #24085, it may be worth reading thru these tickets to get a sense of where we are with fixing outstanding issues with wpautop.

Note: See TracTickets for help on using tickets.