Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#22843 closed defect (bug) (fixed)

_wpMediaViewsL10n localization variable written to html doc twice in post.php and post-new.php

Reported by: gcorne's profile gcorne Owned by: nacin's profile nacin
Milestone: 3.5.1 Priority: normal
Severity: trivial Version: 3.5
Component: Media Keywords: has-patch commit fixed-major
Focuses: Cc:


The _wpMediaViewsL10n variable is being written to the html response twice in post.php and post-new.php. This is being caused because wp_enqueue_media() is being called twice: 1) wp-admin/includes/media.php 2) wp-admin/edit-form-advanced.php

Attachments (1)

22843.diff (420 bytes) - added by nacin 11 years ago.

Download all attachments as: .zip

Change History (7)

#1 @nacin
12 years ago

  • Milestone changed from Awaiting Review to 3.5.1

It's getting called twice deliberately — one for media_buttons (which is generic), one in edit-form-advanced (in case only featured images are supported). It should work just fine if called twice, hence there aren't any crazy checks to avoid it being called more than once.

The double-printing, though, I know I had patched that at one point, but I guess I didn't commit it. This shouldn't be occurring, but the nice thing is this doesn't break anything.

#2 @gcorne
12 years ago

  • Severity changed from minor to trivial

I should have been more clear that it didn't break anything. I just wanted to make sure that it was known.

11 years ago

#3 @nacin
11 years ago

It's possible that someone wishes to enqueue media multiple times for separate post IDs on a page. That's not how it is designed to work. Currently, the last enqueue "wins", while the patch that makes the most sense here would block subsequent calls.

#4 @nacin
11 years ago

In 23214:

Limit the execution of wp_enqueue_media() to once per page. Prevents multiple _wpMediaViewsL10n variables. see #22843.

#5 @nacin
11 years ago

  • Keywords has-patch commit fixed-major added

#6 @nacin
11 years ago

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

In 23269:

Limit the execution of wp_enqueue_media() to once per page. Prevents multiple _wpMediaViewsL10n variables.

Merges [23214] to the 3.5 branch.
fixes #22843.

Note: See TracTickets for help on using tickets.