# placehodor

[![version]][version]

PlaceHodor: Substitute / replace missing images by a default image.
The plugin will (try to) display / generate the correct size (width and height) of the missing image.

## Modes

**Solo** — use one or more images from your media library. Multiple images are picked randomly on each request.

**External services** — delegate to a placeholder webservice:

| Service | Options |
|---|---|
| [Placehold.co](https://placehold.co) | Text, text color, background color, font |
| [Picsum.photos](https://picsum.photos) | Normal, grayscale, blur |
| [DoodleIpsum.com](https://doodleipsum.com) | Style (flat, hand-drawn, outline, abstract, avatars…), background color |
| [LoremFlickr.com](https://loremflickr.com) | Keywords (e.g. "nature, city"), normal or grayscale |

## Origin site

Optional, in the settings page: the URL of the site the content comes from (typically the production site, when PlaceHodor runs on a staging or local copy).

- A media missing here is first looked up on the origin, at the same path in the uploads folder (`HEAD` request, the file is never downloaded). If it exists, the visitor is redirected to it; otherwise the substitute image is used.
- Documents missing under the uploads folder (pdf, mp4, webm, mov, mp3, zip, Office files) are looked up on the origin too; plain 404 when they are not there.
- Answers are cached in transients: a week when the file exists, an hour when it doesn't (network errors and 5xx are not cached).
- The origin can never be the site itself. Leave the field empty to keep the substitute-only behaviour.

## Features

- Intercepts 404 image requests via `.htaccess` rewrite rules and serves a substitute
- Optionally sets a default post thumbnail for posts without one
- Front-end JS fallback: replaces broken `<img>` tags in the browser
- Live preview in the settings page

## Install

1. Unzip into `wp-content/plugins/`
2. Activate the plugin in the WordPress admin
3. Go to **PlaceHodor** in the menu and choose a provider
4. Make sure your permalink setting is not set to "Plain"

[version]: https://img.shields.io/badge/version-1.8.0-%23d85a94.svg
