Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

How Broken Image Links Happen in WordPress and How to Fix Them

Category: WordPress
Tags: # # # #

Maintenance is as big a priority as creating new post content on WordPress sites, particularly when it comes to broken image links. Having a broken link pointing to an external site is bad because it’s a poor user experience. But having a broken link pointing to media content on your own site is bad because it reflects poorly on you, not someone else!

There are several scenarios that commonly play out, each of which results in images disappearing from pages with broken links replacing good, working ones.

Scenario #1 – URL Architecture Changes

Depending on how you’ve added media to a site, there are some cases of changing category structures and naming conventions which can result in images no longer working. This is particularly true if you’ve uploaded images into certain folders and then used relative paths to point to them.

Image linking methods can include:

  • ../images/image1.jpg
  • images/image1.jpg

The fix is to either undo the change made or browse to the page/post with broken links and edit the image link within the page/post, then click update.

Scenario #2 – a Page or Post is Moved

Along the lines of Scenario #1, there are times when you’ve decided to relocate a post or page in WordPress and somehow the system loses track of where they reside.

Newer versions of WordPress are generally very good at handling this situation, but it’s traditionally been a very common happening.

The fix is to either undo the change made or browse to the page/post with broken links and edit the image link within the page/post, then click update.

Scenario #3 – WordPress Settings Changes

The desire to tinker is a powerful one, which is what drives people to edit the WordPress Admin panel Settings → Media.

There can be a file path dialog which appears allowing users to specify a different upload file path. If you’ve got a non-default value in the box, then change it to a default value and save it, many of the blog images will break and the box allowing you to change the value can disappear – a very cool feature of WordPress to protect the default settings, once they’re made default.

You can force WordPress to make the settings box reappear and let you set it back to some other value by following these steps:

  1. Login to cPanel
  2. Run phpMyAdmin
  3. Select your WordPress database
  4. Execute the following query:
    UPDATE wp_options SET option_value = ‘wp-content/foo’ WHERE option_name = ‘upload_path’
  5. Go back into WordPress Admin, Settings → Media and change the value of the upload path, returning it to what it had been before the tinkering session.

If you’re unsure of this, contact the KnownHost technical support team by opening a helpdesk trouble ticket.

Scenario #4 – WordPress Config Changes in wp-config.php

Similar to #3 above, it can be the case that modifications to the wp-config.php file have happened and they’ve caused a wholesale breakage of images in WordPress.

By changing the uploads folder to point elsewhere, WordPress is now looking in the wrong places for the files it needs to put media in posts and pages.

Fixing this problem means you need to:

  1. Login to your control panel
  2. Run File Manager / File Editor
  3. Navigate to the root folder where WordPress wp-config.php is located
  4. Edit the file
  5. Look for define(‘UPLOADS’, ‘wp-content/some-folder-location’);
  6. Change that part to the right of the comma with the correct folder where your uploaded images are found

Good News

In most cases fixing one or two broken images in WordPress can be done by simply opening WordPress Admin Pages or Posts, finding the page or post with the broken media, selecting it and choosing alternative media from the library or uploading.

Other, more technical, solutions are only needed when things have gone wrong on a bigger scale.


Have a WordPress website? Check out our Managed WordPress Hosting and see if we are a good fit for you. KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team ready to help you should you need our assistance. You’re not using KnownHost for the best webhosting experience? Well, why not?