featured-from-prompt is a WordPress plugin that suggests a featured image for a post. It builds a prompt from the post, asks an image API through a small adapter, checks the file that comes back, and holds it for an editor who accepts it with one click. It is for sites with many posts that have no picture of their own. Licence MIT. Version v0.1.0, released 18 November 2026.
It was written from scratch from an idea, as one of the utilities described on the engineering blog. It has not run on a live site.
Opinion pieces, explainers, short news items and round-ups often have no picture. Without a featured image they look broken in archive grids, share previews and feed readers. The usual answers each go wrong.
generic-http JSON adapter, one-shot or submit-then-poll, and an offline fixture adapter for demos and tests.A trigger, whether a button, a REST call, a save, a publish, a WP-CLI command or a backfill, calls Queue::request. That checks eligibility, auto mode and a one-attempt marker, builds the prompt and writes a queue row. Nothing is spent at that point. Worker::run, from WP-Cron, a real cron or gen-queue, then runs the guards: kill switch, provider, pause, eligibility, queue age and a post lock. It reserves cap units, asks spend-meter if present, calls the provider, downloads the result over safe HTTP, runs ImageChecker and stores the pending suggestion. Worker is the only caller of ImageProvider::generate().
The cap reservation is a single atomic UPDATE ... WHERE count < cap, per post and then per day. It is refunded only when no HTTP request was sent. On Accept, the file moves into uploads and sizes are built, but only when its name is one the plugin made and its bytes still sniff as the image type on record.
A generic-http adapter is configured with a body template like this:
{"prompt": "{prompt}", "size": "{width}x{height}", "n": 1}
The default prompt template is generic. It asks for an editorial illustration from the title, summary, category and style, with no text, letters, logos or watermarks, and no real, identifiable person. Auto mode has an off, log and on setting. In log mode the triggers run every guard, record what would have happened and call nothing.
FFP_DISABLED stops every provider call at once.FFP_DAY_CAP can lower the cap but never raise it. There is one automatic attempt per post..., or when deny files cannot be written. Pending files have random names and no public URL.An independent review of the build PR fixed these before the merge.
.. in an attached-file value could make the preview route stream, or attachment deletion remove, a file elsewhere. Only plugin-made names directly in the private directory now count.The review also tightened Accept so a file’s name and sniffed type are re-checked before the move, and corrected the spend-meter, gen-queue and prompt-library integrations to the released contracts.
generic-http speaks JSON only. Multipart uploads are not supported.ffp_accepted to purge a page cache.No issues are open on the repo. Test status: this is v0.1.0. There are 121 PHPUnit tests with 909 assertions, and they pass against a throwaway MySQL 8, including a forked race for the last cap slot, with PHPStan and phpcs clean. Without the database, four tests skip. Provider calls are tested against the fixture adapter and stubs. The CI workflow has not run on GitHub, and there is no production mileage.
It needs PHP 8.1 or later and WordPress 6.4 or later. It has no runtime dependencies. GD or Imagick is optional, and needed only for crop and conversion.
composer require indianopinion/featured-from-prompt
The package is not on Packagist yet, so add a Composer vcs repository entry for https://github.com/IndianOpinion/featured-from-prompt first.
On nginx, also block the pending directory:
location ^~ /wp-content/ffp-private/ { deny all; }