Maintenance

WordPress Media Library Not Loading? Causes and Step-by-Step Fixes

WordPress media library not loading or stuck spinning? Match the symptom to the cause and fix plugin conflicts, PHP limits, permissions and CDN issues.

WordPress Media Library Not Loading? Causes and Step-by-Step Fixes
On this page
  1. Match the symptom to the likely cause
  2. Grid view vs list view: the quickest test
  3. JavaScript conflicts and admin-ajax errors
  4. Memory, PHP limits and large libraries
  5. Broken images or grey boxes after a migration
  6. CDN and media offload plugins
  7. Regenerate missing thumbnails
  8. WordPress media library not loading: a step-by-step checklist
  9. Hosting issues common on Indian shared plans
  10. Keep the library healthy
  11. Quick check: read the error the library is hiding
  12. When to get help
  13. FAQs
Key takeaways
  • Switch to list view first: if it works while grid view spins, the problem is usually JavaScript or admin-ajax, often a plugin conflict.
  • Large libraries, low PHP memory and slow shared hosting can stop the library loading, so check limits and error logs before reinstalling anything.
  • After a migration or CDN change, broken thumbnails usually mean wrong URLs, file permissions or missing image sizes rather than lost files.

You open Media → Library and get a spinner that never stops. Or the grid is empty, every thumbnail is a grey box, or your pages show broken images after a move to new hosting. These are different faults, so first work out which one you have. If the problem is uploading new files and seeing "HTTP error", see how to fix the HTTP error when uploading images.

Match the symptom to the likely cause

What you seeUsually points to
Grid view spins forever or stays emptyA JavaScript error or a failed background (admin-ajax) request
Grid fails but list view shows your filesA plugin or theme conflict, or PHP output breaking the response
Both views are slow or time outMemory or PHP limits, or a very large library on modest hosting
Thumbnails show as grey boxes or broken iconsMissing resized files, wrong URLs, permissions or a CDN problem
Images missing after a migrationOld URLs or upload paths in the database, or files that were never copied

Start with the dull checks: a hard reload (Ctrl+F5), a private window with browser extensions off, and logging out and back in. Ad blockers occasionally block admin scripts.

Grid view vs list view: the quickest test

The grid view is built with JavaScript and fetches your files in the background through admin-ajax.php. The list view is an ordinary page generated by PHP. Switch with the list icon at the top of the library, or add ?mode=list to the upload.php address.

  • List view works, grid doesn't: your files and database are fine. Something is breaking the JavaScript or the background request.
  • Both look empty: check for a date or type filter left selected, or a media folder plugin showing one folder. If it really is empty, the attachment records may be missing from the database (see the migration section).
  • Both are slow or fail: look at memory, server limits and hosting.

JavaScript conflicts and admin-ajax errors

Open the grid view, press F12 and look at two tabs in the developer tools:

  • Console: red errors naming a plugin or theme file are a strong clue. One broken admin script can stop the media library's own scripts.
  • Network: reload and find the admin-ajax.php request whose payload includes query-attachments. Check its status and response.

A healthy response is clean data listing your files. A 403 suggests a security plugin, firewall or CDN rule blocking the request. A 500 points to a PHP error, so check the error log. A response starting with PHP warnings or stray HTML means something printed output where the library expected clean data, often because error display is on. On a live site, keep WP_DEBUG_DISPLAY off and log errors to a file.

To find the culprit, use the Health Check & Troubleshooting plugin to disable plugins and switch theme for your login only, or work on a staging copy, then reactivate things one at a time. Media folder, gallery, page builder and admin-customisation plugins are frequent suspects. The full method is in how to find and fix plugin conflicts.

Memory, PHP limits and large libraries

If the library is slow, times out or fails only on sites with thousands of images, the server may be running out of memory or time. Tools → Site Health → Info shows the PHP memory limit, WordPress memory limit and maximum execution time. An "Allowed memory size exhausted" message in the error log confirms it; see fixing memory limit errors in WordPress. If raising limits only helps for a day or two, the hosting plan may be too small for the site.

Broken images or grey boxes after a migration

Open a broken image in a new tab and look at its address:

  • It shows your old domain, or http instead of https: the database still holds old URLs. A search-replace from the old address to the new one usually fixes it. Use a tool that handles serialised data, such as WP-CLI's wp search-replace or a well-maintained plugin, take a full backup first and do a dry run. A plain find-and-replace on an SQL export can corrupt serialised settings.
  • The address is right but returns a 404: the files aren't on the server. The uploads folder may not have been copied, or only the originals were.
  • It returns a 403: usually permissions, ownership or hotlink protection. Files normally use 644 and directories 755, owned by the account the site runs as; see WordPress file permissions explained.

Then check Settings → Media. If you see "Store uploads in this folder" or "Full URL path to files", a custom upload path came over from the old server; clearing those fields usually restores the default wp-content/uploads. A custom UPLOADS line in wp-config.php can cause the same problem.

Also remember the library lists attachment records in the database, not files in a folder. Images copied into wp-content/uploads by FTP won't appear until they're imported, for example with WP-CLI's wp media import.

CDN and media offload plugins

Plugins that rewrite image addresses to a CDN, or move uploads to cloud storage, add more things that can break:

  • A CDN address that no longer exists, or isn't set up for a new domain
  • Expired storage credentials or a deleted bucket
  • An offload plugin that removed local copies, then was deactivated, leaving WordPress pointing at missing files
  • CDN hotlink protection or firewall rules blocking your own admin

Don't deactivate an offload plugin as a quick test. Check whether local copies exist and use the plugin's own option to bring files back first.

Missing sizes also leave blank or blurry thumbnails on the blog page; see why a WordPress featured image is not showing.

Regenerate missing thumbnails

WordPress creates resized copies of every upload: thumbnail, medium, large and any sizes your theme or plugins add. Grey boxes, or blurry or oddly cropped images, can mean those copies are missing or don't match the current theme, typically after a theme change, new sizes in Settings → Media, or a migration that copied only the originals.

A thumbnail regeneration plugin, or WP-CLI's wp media regenerate (add --only-missing to skip existing sizes), rebuilds them. It's heavy work, so take a backup and run it at a quiet time, in batches for large libraries. If the originals are missing, restore them from a backup.

WordPress media library not loading: a step-by-step checklist

Work through these in order, testing the library after each step. Take a backup before changing anything on a live site.

  1. Hard refresh and try another browser to rule out a cached admin script or browser extension.
  2. Open list view under Media, Library, to see whether only the grid is affected.
  3. Check the browser console for red JavaScript errors and the Network tab for a failing admin-ajax.php request.
  4. Disable plugins on a staging copy, or use a troubleshooting mode plugin, then re-enable them one at a time.
  5. Switch to a default theme briefly, as themes can load scripts in the admin too.
  6. Turn on debug logging and check the PHP error log for memory or timeout errors.
  7. Check file permissions on the uploads folder and confirm the folder path in Settings, Media is correct.
  8. Ask your host whether a security rule or firewall is blocking admin-ajax requests.

Hosting issues common on Indian shared plans

Many small Indian business sites run on entry-level shared hosting. That is fine for a brochure site, but a store with thousands of product images can push such plans hard. Signs that hosting is the cause include the library loading slowly at busy times, timeouts in the error log and the whole admin feeling sluggish, not just media.

Ask your host about PHP memory and execution limits, the PHP version and any resource limits on your account. If the site has outgrown the plan, moving to better hosting can fix this and other slow admin problems; see shared vs VPS vs managed WordPress hosting.

Keep the library healthy

HabitWhy it helps
Resize images before uploadSmaller files upload faster and create lighter thumbnails
Name files clearlyEasier search and better image SEO
Remove unused image sizes added by old themes or pluginsFewer files generated per upload
Clean truly unused media carefullySmaller backups and a faster library, but check usage first
Keep plugins updated and fewFewer script conflicts in the admin

The guide to image optimisation in WordPress covers sizes and compression in more detail.

Quick check: read the error the library is hiding

  1. Open Media > Library, press F12 and open the Console tab. Reload and note any red error, which usually names a plugin or theme file.
  2. Switch the library to list view with the icon at the top. If list view works and grid does not, the problem is JavaScript, not your files.
  3. Use the Health Check & Troubleshooting plugin to disable plugins for your session only and reload the library.

When to get help

Get help when the console shows server errors (500 or 403), when files appear to be missing from the server, or when the problem began after a migration. WordPress maintenance and support covers diagnosis and repair. You can also hire a WordPress developer in India, or send the details through the contact form.

FAQs

Why is my WordPress media library not loading?

The usual causes are a plugin or theme JavaScript conflict, a failing admin-ajax request, low PHP memory, file permission problems or a CDN or offload plugin misconfiguration.

Why does the media library keep spinning?

A spinning grid usually means the admin-ajax request failed or returned an error. Check the browser console and Network tab, then test with plugins disabled on staging.

Will reinstalling WordPress fix the media library?

Rarely. Reinstalling core files only helps if they are corrupted. Find the actual cause first, because the problem usually sits in a plugin, theme or server setting.

Why are images missing after migrating my site?

Often the database still points to the old URL, the uploads folder did not copy fully, or file permissions are wrong. Fix the URLs and permissions, then regenerate thumbnails.

Can a security plugin stop the media library loading?

Yes. Some firewall rules block admin-ajax requests. Check the plugin's logs and whitelist the request, rather than turning protection off entirely.

Need help with your website?

I'm a freelance WordPress developer building fast, SEO-friendly websites since 2020. Tell me what you need and I'll reply with a plan and a fixed quote, usually within 24 hours.

Found this useful? Share it:
Contact

Let's build your next website

Available for freelance projects, agency white-label work and long-term maintenance. Feel free to pass this along to your team or company.

I reply within 24 hours, usually the same day. Your details are emailed to me, then WhatsApp opens so we can chat right away.

Chat now