More fixes

WordPress Media Library not loading: spinner forever, or an empty grid

You open Media, Library and the grid spins forever, or it says "No media items found" when you know the photos are there. The "Add Media" button in a post may show the same empty box. Your files are almost never lost. The page that lists them is failing, and the cause is usually one of four things. Here is how to tell which, and the fix for each.

What the owner sees

harborbakery.example/wp-admin/upload.php

What the checks found


  

Find out which case it is (five minutes)

  1. Switch to list view. On Media, Library click the list icon next to the grid icon (or open /wp-admin/upload.php?mode=list). If your files show up in the list but not the grid, the files and database are fine and the grid's background request is failing.
  2. Look at the files themselves. Open one image's address directly, for example /wp-content/uploads/2026/10/photo.jpg. If it loads, the files are there. If it gives 403 or 404, it is a permissions or path problem, not the library.
  3. Watch the background request. In Chrome press F12, open Network, reload the Media page and click the request to admin-ajax.php (action query-attachments). A good one returns a list in square brackets. A PHP warning, a blank reply, a 500 or a 403 is your clue.
  4. Did it start after an update? A plugin or theme updated the same day is the usual suspect, especially media, optimisation, security and page-builder plugins.

The fixes, by case

  1. A plugin breaks the request: deactivate all plugins, check the grid, then turn them back on one at a time until it breaks again. The Health Check & Troubleshooting plugin does this for your login only, so visitors see nothing change.
  2. The reply starts with a PHP warning or a blank line: the grid cannot read a reply that has anything before the opening [. Turn off on-screen errors (define('WP_DEBUG_DISPLAY', false); in wp-config.php) and remove stray spaces or blank lines before <?php in functions.php or a recently edited plugin file.
  3. admin-ajax.php returns 403: a security plugin, the host's firewall (ModSecurity) or Cloudflare is blocking it. Find the blocked request in the plugin's or host's log and allow it; do not switch the firewall off for good.
  4. Images give 403 or 404 directly: folders in wp-content/uploads should be 755 and files 644. Also check Settings, Media: the "Store uploads in this folder" path should be empty or wp-content/uploads, not an old server path left over from a move.
  5. It spins only on big libraries: the request runs out of time or memory. Raise WP_MEMORY_LIMIT to 256M and ask the host about the PHP time limit; list view works meanwhile.
  6. Moved the site recently: image addresses may still point at the old domain or http://. A search-and-replace of the old address in the database (with a backup first) fixes it.

What you see, what it means, what it needs

What you seeWhat it meansUsual fix
Grid spins forever, list view worksThe grid's admin-ajax request failsFind the plugin, or clean the reply
"No media items found" but files existThe request returned something that is not a listCheck admin-ajax in the Network tab
admin-ajax.php gives 403A firewall or security plugin blocks itAllow that request in the firewall log
Thumbnails broken, direct image link 403/404Wrong folder permissions or upload path755 folders, 644 files, reset Settings, Media path
Started right after an updateThat plugin or theme broke itRoll it back or wait for its fix

What not to do

Most cases are one plugin found or one warning removed. If the library still will not load, that is what the box below is for. Related: Images not showing, Upload errors, "Not a valid JSON response".