Make WordPress Core

Opened 14 years ago

Closed 14 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 Owned by: nacin
Priority: normal Milestone: 3.5.1
Component: Media Version: 3.5
Severity: trivial Keywords: has-patch commit fixed-major
Cc: Focuses:

Description

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 14 years ago.

Download all attachments as: .zip

Change History (7)

#1 @nacin
14 years ago

  • Milestone Awaiting Review3.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
14 years ago

  • Severity minortrivial

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

@nacin
14 years ago

#3 @nacin
14 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
14 years ago

In 23214:

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

#5 @nacin
14 years ago

  • Keywords has-patch commit fixed-major added

#6 @nacin
14 years ago

  • Owner set to nacin
  • Resolutionfixed
  • Status newclosed

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.