Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#29520 closed defect (bug) (fixed)

WP 4.0 "add media" button on edit page not functioning

Reported by: lcody's profile lcody Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.0.1 Priority: normal
Severity: major Version: 4.0
Component: Media Keywords: has-patch commit fixed-major
Focuses: ui, javascript, administration Cc:

Description

Happens on edit.php

console returns this error on page load:

Uncaught Error: Syntax error, unrecognized expression: [name=] load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,plupload,json2&ver=4.0:2

and console returns this error onclick of 'add media' button:

Uncaught TypeError: Cannot read property 'hasClass' of undefined load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,schedule,wp-ajax-response,autosave,jqu…:1045

Attachments (1)

29520.patch (1.1 KB) - added by azaozz 10 years ago.

Download all attachments as: .zip

Change History (24)

#1 @SergeyBiryukov
10 years ago

  • Component changed from General to Media
  • Keywords reporter-feedback added

Does it still happen with all plugins disabled and a default theme (Twenty Fourteen or Twenty Thirteen) activated?

#2 @lcody
10 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

My bad, plugin caused the issue. I thought I had updated it, but apparently I had not.

#3 @SergeyBiryukov
10 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted

#4 @nacin
10 years ago

What was the plugin? We don't like it when things break in an update, even if it's the plugin's "fault," so it helps to know so we can look into it.

#5 @lcody
10 years ago

Plugin was Post Types Order, found at https://wordpress.org/plugins/post-types-order/. Updating the plugin fixed all issues.

#6 follow-up: @ccwtech
10 years ago

  • Resolution worksforme deleted
  • Severity changed from normal to major
  • Status changed from closed to reopened

I'm having the same issue. Not using that plug in. Any ideas?

Last edited 10 years ago by ccwtech (previous) (diff)

#7 in reply to: ↑ 6 @SergeyBiryukov
10 years ago

  • Keywords needs-refresh reporter-feedback added
  • Milestone set to Awaiting Review

Replying to ccwtech:

I'm having the same issue. Not using that plug in. Any ideas?

  1. Does it still happen with all plugins disabled and a default theme (Twenty Fourteen or Twenty Thirteen) activated?
  2. Are there any JavaScript errors in your browser?

#8 @SergeyBiryukov
10 years ago

  • Keywords needs-refresh removed

This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.


10 years ago

#10 @ccwtech
10 years ago

  • Resolution set to worksforme
  • Status changed from reopened to closed

In this case it was this plugin for me. Disabling it fixed the issue.
Comprehensive Google Map Plugin
Activate | Edit | Delete
A simple and intuitive, yet elegant and fully documented Google map plugin that installs as a widget and a short code. The plugin is packed with useful features. Widget and shortcode enabled. Offers extensive configuration options for markers, over 250 custom marker icons, marker Geo mashup, controls, size, KML files, location by latitude/longitude, location by address, info window, directions, traffic/bike lanes and more.

Version 9.0.20 | By Alex Zagniotov | View details

#11 @ericlewis
10 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

This is because plugins are depending on functionality in wp-admin/js/media.js, in which we're bootstrapping media grid.

We need a conditional check around the wp.media() call to ensure this only runs on the media grid page.

#12 @SergeyBiryukov
10 years ago

  • Keywords needs-patch added; reporter-feedback removed
  • Milestone changed from Awaiting Review to 4.0.1

#13 follow-up: @ericlewis
10 years ago

  • Keywords dev-feedback added

Not sure about the best approach here.

We need awareness in Javascript whether we're on the media grid page vs. any other page (including the Media list page).

A conditional like document.body.className.indexOf( 'upload-php' ) !== -1 comes to mind, but this is also returns true if we're on the Media list page.

#14 @guyerb
10 years ago

The Comprehensive Google Map plugin is also keep Yoast SEO per-page options from displaying correctly. This sounds like a seperate issue?

http://wordpress.org/support/topic/seo-options-not-there-since-40?replies=21#post-5981158

#15 in reply to: ↑ 13 @azaozz
10 years ago

Replying to ericlewis:

We need awareness in Javascript whether we're on the media grid page vs. any other page (including the Media list page).

As the media grid still uses <div class="wrap"> as the "main wrapper", we can easily add an ID to it from PHP and look for that from JS. Don't think it would need anything more complex.

@azaozz
10 years ago

#16 @azaozz
10 years ago

29520.patch works well here.

Not sure this is the only problem with these plugins though, looking further.

#17 @azaozz
10 years ago

  • Keywords has-patch added; needs-patch dev-feedback removed

Don't see JS errors with the patch and the above plugin enabled.

#18 @SergeyBiryukov
10 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from reopened to closed

In 29725:

Make sure we're on the media grid page before calling wp.media().

props azaozz.
fixes #29520 for trunk.

#19 @SergeyBiryukov
10 years ago

  • Keywords commit fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 4.0.1.

#20 @wonderboymusic
10 years ago

#29575 was marked as a duplicate.

#21 in reply to: ↑ description @Fadookie
10 years ago

I was seeing this on a clean install of 4.0 also. First off I turned off CONCATENATE_SCRIPTS in wp-config. This showed that there was a 403 accessing jquery. So it was my bad as I'm the maintainer of my site, but this is a pretty gnarly breakage in my case that was difficult to track down.

Last edited 10 years ago by Fadookie (previous) (diff)

#22 @jorbin
10 years ago

I confirmed that r29725 applies cleanly to the 4.0 branch and fixes the issue that is present when used in conjunction with the previous version of the comprehensive-google-map-plugin plugin.

This is ready to be merged.

#23 @nacin
10 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 30254:

Make sure we're on the media grid page before calling wp.media().

Merges [29725] to the 4.0 branch.

props azaozz.
fixes #29520.

Note: See TracTickets for help on using tickets.