WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#29566 closed defect (bug) (fixed)

Grid Media Library Won't Load in 4.0 w All Plugins Disabled

Reported by: johnstonphilip Owned by: SergeyBiryukov
Milestone: 4.0.1 Priority: normal
Severity: normal Version: 4.0
Component: Media Keywords: has-patch commit fixed-major
Focuses: ui, javascript Cc:
PR Number:

Description

Upon upgrading to 4.0, on 10 of my WP installs, everything is working perfectly.

However, in 1 of my installs, I can't get anything to show when the Media Library ("Dashboard" > "Media") is set to "Grid" mode. Rather, the spinner wheel just spins forever.

It DOES load correctly when I have it set to "List" mode.

I have WP_DEBUG mode on and no errors are showing. There are also no javascript errors showing in the console on Google Chrome.

Steps I have taken already:

  • I have de-activated all plugins and reverted to the twenty fourteen theme
  • I checked the server to make sure there is enough RAM, Hardrive space, and other resources.
  • I checked permissions in apache and all are set to be owned by apache
  • I restarted Apache
  • I restarted the entire server (which is a LAMP setup)
  • I have reverted to 3.9.2 and back to 4.0 multiple times (there is no "grid" mode in 3.9.2)

Attachments (1)

29566.patch (1.2 KB) - added by SergeyBiryukov 5 years ago.

Download all attachments as: .zip

Change History (11)

#1 @ocean90
5 years ago

  • Keywords reporter-feedback added

Hey, can you please check the response of the AJAX request?

  • Enable WP_DEBUG
  • Open Chrome's DevTools
  • Go to wp-admin/uploads.php
  • Switch to Network tab and set filter to XHR (https://cloudup.com/ijJ4IYtHCSh)
  • Reload page
  • Select admin-ajax.php and switch to the Response tab

#2 @johnstonphilip
5 years ago

Hey thanks for sending that. Here is what it is showing:

Notice: Trying to get property of non-object in /var/www/vhosts/creativeready.com/wp-includes/media.php on line 2646

Notice: Trying to get property of non-object in /var/www/vhosts/creativeready.com/wp-includes/media.php on line 2650

http://cl.ly/image/1F2i1r0S0i2q

Last edited 5 years ago by johnstonphilip (previous) (diff)

#3 @SergeyBiryukov
5 years ago

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

You have some images attached to non-existing posts.

Normally, wp_delete_post() makes sure not to leave orphaned images.

Still, we should check if the parent post exists, like we do in class-wp-media-list-table.php.

See 29566.patch.

#4 @johnstonphilip
5 years ago

Good call Sergey - thanks!

P.S. do you know if there is a way I can filter media to show items like that: that are attached to a post which has been deleted?

#5 @SergeyBiryukov
5 years ago

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

In 29724:

Avoid PHP notices in media modal caused by orphaned attachments.

fixes #29566 for trunk.

#6 @SergeyBiryukov
5 years ago

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

Reopening for 4.0.1.

#7 @Frumph
5 years ago

@SergeyBiryukov

Additional possibly related. Contributor role granted upload_files, grid view ajax in add media not showing uploaded images.

Media library - view all - grid view / not showing uploaded images, list view showing images.

Last edited 5 years ago by Frumph (previous) (diff)

#8 @nacin
5 years ago

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

In 30259:

Avoid PHP notices in media modal caused by orphaned attachments.

Merges [29724] to the 4.0 branch.

props SergeyBiryukov.
fixes #29566.

#9 @JesperT
4 years ago

I got the same error and discovered that in my functions.php used the wrong hook to run remove_menu_page.
(admin_init instead of admin_menu)

#10 @joemcgill
3 years ago

#34662 was marked as a duplicate.

Note: See TracTickets for help on using tickets.