Wayback Image Restorer is a WordPress plugin that scans for missing images, looks them up in the Internet Archive Wayback Machine, and restores recoverable files back into the WordPress media library.
This repository now uses a standard root-level WordPress plugin layout so GitHub-based update checks can read the plugin header directly from main.
- Scan posts, pages, featured images, media library records, and
srcsetimage candidates - Detect broken local uploads and inaccessible external image URLs
- Query the Wayback Machine CDX API for archived image snapshots
- Restore archived images into the WordPress media library
- Update post content and featured image references after restore
- Support common image formats including JPEG, PNG, GIF, WebP, SVG, BMP, and TIFF
- Try legacy
.png,.jpg, and.jpegarchive paths when a missing image is now referenced as.webp - Offer dry-run mode, batching, logging, and GitHub-based updates
- The scanner crawls published content and attachment records for image URLs.
- Each image is checked locally or over HTTP to decide whether it is missing.
- Missing images are searched in the Wayback Machine.
- If an archive exists, the file can be downloaded and imported into WordPress.
- The plugin updates the original references to the restored media item.
.
|-- wayback-image-restorer.php
|-- README.md
|-- README.txt
|-- composer.json
|-- admin/
|-- includes/
|-- languages/
|-- public/
`-- vendor/
Key files and directories:
wayback-image-restorer.php: main plugin bootstrap and plugin headerincludes/class-wayback-api.php: Wayback Machine lookup and download logicincludes/class-image-scanner.php: broken image discoveryincludes/class-image-restorer.php: media import and reference replacementincludes/class-plugin.php: plugin wiring and GitHub update checker setupadmin/: WordPress admin UI, AJAX handlers, and assetspublic/: frontend-side hooksREADME.txt: WordPress-style plugin readme used for plugin metadata
- Scans post content with image and
srcsetextraction - Includes featured images and media library attachments
- Distinguishes local versus external images before checking them
- Uses batching and a resource manager to avoid exhausting low-resource hosts
- Uses the CDX API at
https://web.archive.org/cdx/search/cdx - Filters for successful image responses
- Builds raw-content archive URLs using the
id_snapshot format - Falls back from
.webpto legacy.png,.jpg, and.jpeglookup candidates where relevant
- Downloads the chosen source
- Validates MIME type before import
- Repairs existing attachment records when the missing image belongs to the media library
- Imports via WordPress media handling when a brand-new attachment is needed
- Updates content or featured-image references for affected posts when URLs change
- Logs are stored under
wp-content/uploads/wayback-image-restorer/logs - The plugin supports rotation, viewing, export, and cleanup
Requirements:
- PHP 7.4+
- WordPress 6.0+
- Composer, only when updating dependencies
Notes:
- The
vendor/directory is committed, so a normal install does not require Composer - If dependency changes are needed, run
composer install --no-dev --prefer-dist --optimize-autoloader - The plugin update checker is configured against this GitHub repository and the
mainbranch
- Keep the main plugin file at repository root so the GitHub updater can read the plugin header correctly
- Bump versions consistently in
wayback-image-restorer.phpandREADME.txt - Keep
README.txtaccurate because WordPress uses it for plugin details and upgrade notes
Implemented:
- Broken image scanning
- Wayback archive lookup
- Archive download and restore flow
- Post content replacement
- Featured image handling
- Logging and admin tooling
- GitHub-based update checks
GPLv2 or later. See LICENSE.