How to Fix Missing Images in WordPress

Missing images in WordPress? WordPress images disappearing seemingly at random? This is a common issue and is discussed quite frequently in the WordPress world.

Most of the times it can be resolved by following a few simple steps. You can use this as a general procedure for addressing this issue.

The first thing you will want to do is start by clearing ALL caches. This includes, Server Cache, WordPress Cache and your Browser Cache.

Before You Begin: Preliminary Checks

CREATE A BACKUP! I can’t stress this enough. Any time you are making any changes, ALWAYS create a backup.

Step 1. Make a Backup of your WordPress site and Database.

Step 2. Clear ALL Caches: Server Cache, WordPress Cache and Browser Cache. Re-check if the images are still missing.

Step 3. Restore “.htaccess” to the Default .htaccess for WordPress

The .htaccess file in WordPress can sometimes be modified by Themes or Plugins and cause undesired effects in your WordPress website. This can be easily resolved by replacing the ‘.htaccess’ file with the default ‘.htaccess’ file for WordPress. The changes can be easily reverted if you find .htaccess wasn’t the issue.

Here are the default rules for .htaccess:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

You can rename the original .htaccess file to something like .htaccess.bak then create a new one. This way you have a backup of your original .htaccess file and can restore if it needed.

404 Image not Found!

If you are seeing a ‘404 Image not Found‘ error or are seeing alternative text on your Posts or Pages instead of your image, you will first want to confirm the image file still exists on the server first and foremost. Images can become corrupted or deleted accidentally.

Step 1. Get the FilePath for the image: Right-Click on the image then select ‘Copy Image Address‘. This will place the relative file path of the missing image in your clipboard. 

Step 2. Paste the URL you’ve copied into your browser’s address bar and Press Enter

If you see an image this means it exists on the server and something in your WordPress site is preventing your image from displaying. You may Need to Regenerate your WordPress Media Files.

If you do not see an image, the image file may be missing or corrupt.

SOLUTION: You can try deleting the image from the WordPress media section, re-uploading the image and then inserting it into your page or post once more. 

If you’re seeing a white page instead of the image, this happens when you have resized an image on your page or post from the original image size. This can generally be resolved by regenerating your image thumbnails in WordPress.

Regenerate WordPress Media Files

WordPress automatically scales and generates thumbnails for your images. This also happens when you insert an image into a page then resize the image. Sometimes these image files can become corrupted or are not generated properly or something else has interrupted the process. You can generally resolve this by Regenerating Media Files in WordPress. 

If you’re comfortable in WP-CLI, you can skip the steps below and just run this command instead:

wp media regenerate

Step 1. Install and Activate the Force Regenerate Thumbnails Plugin

Regenerate WordPress Media Files

Step 2. From the WordPress Dashboard, hover over ‘Tools‘ then select ‘Force Regenerate Thumbnails

Regenerate WordPress Thumbnails

Step 3. On the next screen, click on the ‘Regenerate all Thumbnails‘ button. 

How to Regenerate WordPress Thumbnails

Step 4. On the next screen, you should see a progress bar and a confirmation message once the process is complete. The time it takes depends on many factors including the number of images you have stored in your WordPress site. Be sure you allow adequate time for the process to complete.

How to Regenerate WordPress Images

Re-check your WordPress site to see if the images are there or are still missing.

Check Folder Permissions for WordPress Uploads Folder

Step 1. Login to your WordPress Dashboard

Step 2. Hover over ‘Settings‘ then Select ‘Media

how to fix wordpress folder permissions

Step 3. Check the option ‘Organize my uploads into month- and year-based folders‘ (if not already checked) then press the ‘Save Changes‘ button

wordpress media settings

Step 4. Check Permissions via SFTP or ‘File Manager’ if you’re host uses cPanel

cPanel File Manager

Step 5. Navigate into the Document Root for your WordPress website (where your WordPress site files are stored)

WordPress Document Root in File Manager

Step 6. Navigate into your ‘ /wp-content ‘ folder

How to rename the WordPress plugins folder

Step 7. Locate the ‘Uploads’ folder then ‘Right-Click‘ the folder and select ‘Change Permissions‘. 

WordPress Uploads File Permissions

Step 8. Check or Uncheck the boxes until the permissions read: 755

WordPress File Permissions

See an animated Example of the Process Below:

fix permissions settings for WordPress Uploads Folder

Clear the Server Cache and then your Browser Cache, then refresh your Posts and Pages to confirm the images are displaying properly. If the images are still not displaying or some are missing continue troubleshooting.

Specify or Define Your WordPress Uploads Folder

You may need to specify or Define your WordPress Uploads folder in your ‘wp-config.php‘ file. This tells WordPress where to look for your image uploads in order to serve them properly within your Posts and Pages. To do so, follow the steps outlined below.

Step 1. Login to cPanel and select ‘File Manager‘ (or use your favorite SFTP program instead)

cPanel File Manager

Step 2. Navigate into the document root of your website (where your WordPress files are stored)

Note! The document root is usually the ‘public_html’ directory in cPanel environments for your primary domain. Other times it will be something like ‘public’.

Step 3. Right Click on ‘wp-config.php‘ and select ‘Edit

Step 4. Copy the Following Code:

define( 'UPLOADS', 'wp-content/uploads' );

Step 5. Paste the Code into your ‘wp-config.php‘ file somewhere towards the end of the file as in our Example Below:

how to define uploads folder in wordpress

Step 6. Click ‘Save Changes‘ in the top Right-Hand corner of File Manager. Or re-upload the new version of your file via SFTP.

Clear ALL Caches and re-check the images to see if they are still missing or displaying.

Change your PHP Version to the Latest Version

WordPress is a PHP application. If you’re WordPress site, Theme and Plugins are all up to date they should be compatible with the latest versions of PHP. Sometimes they are not backwards compatible with older versions of PHP which can cause errors or undesirable effects in your site. Thus, it’s important to ensure your using the latest PHP version. You can change the PHP version that is processing PHP applications for your Domains easily using the MultiPHP Manager in cPanel. Or, for Kinsta customers, you can change this in MyKinsta under Sites → Tools → PHP Engine:

Change PHP version in MyKinsta.

Identify Plugin and Theme Issues

If all of the steps above have not resolved your issue, it may be time to start looking into plugins and themes as the possible culprits. You can follow common troubleshooting procedures for WordPress Plugins and Themes to identify an issue. If a Plugin or Theme is found to be the culprit you can try either replacing the Plugin or Theme with a comparable alternative, deactivating the Plugin or reaching out to the Plugin or Theme Developer Directly to report and request assistance with the issue. To start ruling out your Plugins and Themes as the possible issue, follow the steps we’ve outlined below.

Update WordPress Core, Plugins and Themes

Important updates for WordPress are rolled out periodically to ensure the security and stability of your WordPress site(s). The same can be said for Plugins and Themes. You will want to apply any available updates to the WordPress Core, Plugins and Themes to rule out issues with version compatibility. 

Switch to a Default WordPress Theme to Rule out Theme Issues

Change your WordPress Theme to something like Twenty Twenty to rule out issues with your theme. If your images are displaying after changing your theme it’s time to contact the developer of your theme for assistance with the issue. If switching your theme hasn’t resolved your issue, you can switch your theme back to the original theme you were using and continue troubleshooting.

Rename your Plugins Folder to Rule Out Plugin Issues

Rename your WordPress Plugin Folder to something temporary to rule out an issue with your Plugins. Once you’ve renamed the Plugins folder you can refresh your website (after clearing the server cache and browser cache) and check to see if the missing images are now displaying. If they are displaying, you’ve successfully isolated the issue to a plugin. If not, then you can rule out Plugins as a possible cause. To rename your Plugins directory, follow the steps outlined below.

Step 1. Login to cPanel (or use your favorite SFTP program to connect to your webserver to view and manipulate your website files)

Step 2. Click on the ‘File Manager‘ icon.

cPanel File Manager

Step 3. Navigate into the Document Root for your WordPress site. 

Step 4. Navigate into your ‘/wp-content‘ folder.

How to rename the WordPress plugins folder

Step 5. Locate the ‘plugins‘ folder. Right-click the folder then select the option ‘Rename‘. 

Rename Plugins Folder

Step 6. Rename the folder to ‘plugins.BAK‘ then click ‘Rename File‘ to save your changes.

Step 7. Clear the server Cache, as well as your Browser Cache then refresh your Website to see if you’re images are displaying.

Deactivate Plugins One By One to Isolate the Problem Plugin

If after renaming your Plugins folder that your images are now displaying, you will need to deactivate your plugins one by one to determine which plugin or plugin(s) are causing an issue. Once you have identified the plugin, reach out to the plugin developer for assistance with the issue.

If you have a lot of plugins you can run a script which will activate and deactivate plugins automatically and locate the problem plugin quickly.

If this is a very rare case and your images still aren’t displaying after trying all of the steps outlined in our guide, you should reach out to Support Team of your host to rule out server-side issues or assist in additional troubleshooting within scope. Otherwise, reach out to your developer for further assistance.

Leave a Reply

Your email address will not be published. Required fields are marked *