Missing media files or broken links in WordPress
One moment your media files are fine, and the next, you notice broken images or missing media on your posts and pages. You might even see “404 errors” when trying to access media directly. This can happen for several reasons, from incorrect file paths to issues with the database or server.
Here’s a simple guide to help you fix missing media files and broken links quickly.
Step 1: Check for incorrect URLs or file paths
Sometimes, media files become inaccessible due to incorrect file paths. This can happen if you move your site, change domains, or if there are issues with the database.
- Go to your WordPress Dashboard > Media > Library.
- Check if the missing images are listed and their URLs are correct.
- If the images are showing broken, click on the file and note down the file URL to check if it leads to the correct path on your server.
If the URL is wrong, you can either manually fix it or use a plugin like Velvet Blues Update URLs to update all internal links.
Step 2: Regenerate Thumbnails
If your images aren’t displaying correctly, it could be due to missing or corrupt image sizes (thumbnails). Regenerating thumbnails can help:
- Install the Regenerate Thumbnails plugin from the WordPress repository.
- Once installed, go to Tools > Regenerate Thumbnails.
- Click on Regenerate All Thumbnails.
This will rebuild all image sizes for your media, ensuring that the right size gets displayed.
Step 3: Re-upload missing media files
If you’ve tried the above steps and files are still missing, try re-uploading them to the Media Library:
- Go to Dashboard > Media > Add New.
- Upload the missing files again.
- Once uploaded, check if the images now display correctly in your posts/pages.
Step 4: Check your .htaccess file for redirects
Sometimes, .htaccess issues can cause media files to not load properly. If you’ve moved your site or changed URLs, your server might be set to redirect media links incorrectly.
- Go to your site’s root directory via FTP or File Manager.
- Open the .htaccess file.
- Look for any redirects or rewrite rules that might affect media files and remove or correct them if necessary.
Step 5: Check file permissions
Improper file permissions can also prevent media files from displaying.
- Via FTP or File Manager, navigate to the wp-content/uploads folder.
- Check that the files have the correct permission settings:
- Directories should be set to 755.
- Files should be set to 644.
If permissions are wrong, correct them to ensure the server can serve the media files.
Step 6: Restore from a backup (if needed)
If all else fails, consider restoring from a recent backup. If the media files were working before and have suddenly gone missing, restoring a backup might bring them back.