sandywp / plugins / remove-broken-images

Remove Broken Images

4.0 out of 5 stars. 4.0 4 reviews

Very simply, uses JavaScript to remove broken images from page display.

Launch a sandbox with this plugin → No signup.
Ready in seconds.

v1.5.1 800+ installs WP 4.9+

your-sandbox.sandywp.com/wp-admin
Remove Broken Images running inside a SandyWP sandbox

About this plugin

This is an extremely simple plugin that uses jQuery to remove broken images from displaying on your pages.

Note that version 1 does not alter any content in the database, nor does it remove the image tags from the initial HTML output of the page, so it doesn’t stop 404 errors, nor does it benefit SEO or PageSpeed scores. It does, however, prevent the dreaded “broken image” icon from appearing in your pages, and in most cases it will remove the blank space some browsers allocate for images as they are loading.

Coming in version 2: We’ll be adding an admin tool to let you see a list of posts and pages containing broken images, along with a tool to automatically remove their img tags from the database.

Questions

I installed and activated the plugin. Now what?

That’s it! There is no configuration necessary. The plugin adds a compact bit of JavaScript that detects if an image is returning a 404 error, and removes its HTML code from displaying on the page.

Does this plugin delete the image code from my page/post in the WordPress database?

No, version 1 does not make any changes whatsoever to your database. It also does not remove the missing image file’s URL from the HTML that is sent to the user’s web browser; it removes the tags from the DOM (Document Object Model) after the page has been loaded, using JavaScript, to prevent “broken image” icons, extra white space, and links/captions associated with those missing images from displaying.

How can I redirect to the home page when an image is missing on a post?

The r34rbi_missing_image jQuery hook (added in version 1.4.0) allows you to modify the plugin’s behavior with custom code, whenever a missing image is encountered. It is used by the r34rbi_redirect_on_missing_image PHP filter (also added in version 1.4.0) to easily redirect to the home page in this situation, by adding this snippet of PHP code to your theme:

add_filter('r34rbi_redirect_on_missing_image', '__return_true');

You can replace '__return_true' with a custom callback function to change the redirect URL to something other than your site’s home page.

4.0

4 reviews

  • 5 ★ 3
  • 4 ★ 0
  • 3 ★ 0
  • 2 ★ 0
  • 1 ★ 1

Ratings come from WordPress.org. SandyWP does not collect its own reviews.

sandywp / also on the shelf

Try another plugin

  • Broken Link Checker

    3.8 · 500K+ installs

    Broken Link Checker helps you catch broken links & images fast, before they hurt your SEO or UX. Scan and bulk-fix issues…

  • All 404 Redirect to Homepage

    4.1 · 200K+ installs

    Using this plugin, you can fix all 404 error links by redirecting them to homepage using the SEO 301 redirection. Improve your…

  • Replace broken images with a default image, hide them entirely, or set custom per-image redirection rules. Lightweight, fast, and…

Spin up a real WordPress site in seconds.

Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.