WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#18456 closed defect (bug) (fixed)

calling add_editor_style() twice results in the css being added multiple times

Reported by: dd32 Owned by: dd32
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.2
Component: Editor Keywords: has-patch
Focuses: Cc:

Description

In the event a Theme, and a Child theme, both call add_editor_style() the TinyMCE css list will double up:

content_css:"
http://localhost/branch/3.2/wp-content/themes/twentyeleven/editor-style.css,
http://localhost/branch/3.2/wp-content/themes/twentyeleven-child/editor-style.css,
http://localhost/branch/3.2/wp-content/themes/twentyeleven/editor-style.css,
http://localhost/branch/3.2/wp-content/themes/twentyeleven-child/editor-style.css"

(New lines added for readability)

Affects both trunk and 3.2, This does point out it's a "doing it wrong" to call the add_editor_style() in the child theme, but we should also array_unique() the $editor_styles array before searching for the files to enqueue IMO.

Attachments (1)

18456.patch (543 bytes) - added by SergeyBiryukov 8 years ago.

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
8 years ago

  • Keywords has-patch added; needs-patch removed

#2 @dd32
8 years ago

  • Milestone changed from Awaiting Review to 3.3

#3 @dd32
8 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In [18571]:

Only include extra TinyMCE stylesheets once. props SergeyBiryukov. Fixes #18456

Note: See TracTickets for help on using tickets.