WordPress.org

Make WordPress Core

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

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 16 months ago.

Download all attachments as: .zip

Change History (7)

comment:1 nacin16 months 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.

comment:2 gcorne16 months 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.

nacin16 months ago

comment:3 nacin16 months 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.

comment:4 nacin16 months ago

In 23214:

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

comment:5 nacin16 months ago

  • Keywords has-patch commit fixed-major added

comment:6 nacin16 months 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.