Skip to main content

Cache Management

Every screenshot the plugin captures is saved as a local WebP file on your server. The plugin serves these directly from your site, so once a screenshot exists it costs you nothing further to use - no recurring quota consumption, no dependency on the screenshot server being online.

This page covers where those files live, how to manage them, and how the cache-flip orphan sweep keeps things tidy when you switch Image Sources around.

Where screenshots are stored

wp-content/uploads/dynamic-og-images/

One WebP file per post, named by the post's numeric ID (for example 42.webp). The plugin manages this directory automatically; you should not need to add or remove files manually.

Cache statistics on the Settings page

Cache statistics on the settings page

At OG Images > Settings, the Cache management section shows the number of screenshots currently cached and the total disk space they are using. This updates each time the Settings page is loaded. On a typical site with a few hundred posts and the default 80% WebP quality, expect 30-80 KB per screenshot.

Clearing the cache

Clear Entire Cache

The Cache management section on OG Images > Settings has a Clear Entire Cache button. It deletes every cached WebP file from the dynamic-og-images/ directory. Existing posts revert to their Image Source's "nothing cached" behaviour (your SEO plugin's default, the Featured image, or whatever the per-post mode dictates) until they get re-captured.

Use this when you want a clean slate - for example, after a major site redesign where every existing screenshot is now visually stale. Note that the next time the daily refresh runs (or whenever a post is published / updated / manually regenerated), the affected posts will be queued for re-capture and will consume quota - but only those whose resolved Image source is Auto-screenshot or Featured-with-fallback (when no Featured Image is set). Posts on Featured / Custom / Off do not consume quota at all.

Regenerate All Screenshots

Queues every eligible, published page and post for re-capture. Unlike the daily refresh, this ignores the freshness check - even pages whose existing screenshot is well within the refresh interval get re-captured.

This button now lives on the Dashboard sub-page (OG Images > Dashboard) rather than the Settings sub-page, alongside the headline screenshot quota.

Use this after content changes that affect many pages site-wide (a new theme, a new header design, an updated logo) where waiting for the refresh interval to come round naturally would leave stale previews live for too long.

This consumes quota. Each captured page uses one screenshot from your monthly allowance. On a site with hundreds of pages, this can exhaust a small allowance quickly. The Dashboard shows your current usage right next to the button; check it before clicking. Posts whose Image Source is Featured / Custom / Off are intentionally skipped (no screenshot needed), so the queue count reflects only what will actually burn quota.

The captures happen in the background via WP-Cron in small batches. On most sites the queue drains within an hour or two; very large sites can take longer. You can close the browser - the queue keeps running.

Refresh interval

Cached screenshots are considered fresh for the configured number of days (default 30). Past that age, the next daily refresh queues them for re-capture. The old screenshot continues to be served until the new one is ready, so visitors and crawlers never see an absent og:image.

Set in OG Images > Settings under Refresh interval (days).

Pick a value that fits your site's editorial cadence and your monthly quota. Sites that change rarely can extend the interval to 60 or 90 days and stretch the quota further; sites whose pages drift often (date-stamped landing pages, time-sensitive content) might want 14 or 7 days.

The refresh interval only applies to posts whose resolved Image Source is Auto-screenshot or Featured-with-fallback. Featured / Custom / Off sources read live attachment data each render, so there is nothing to refresh on a schedule.

Regenerate on post update

Optional toggle in OG Images > Settings. When on, saving any published post queues an immediate fresh capture for that post - regardless of the refresh interval, but only if the resolved Image Source needs a screenshot.

Useful for sites that edit posts frequently and want their og:images to reflect the latest version. Leave off if you save posts often but only sometimes change their actual visible content - otherwise you will burn quota on trivial edits.

Per-post Regenerate Now

From the block editor sidebar on any post, the Regenerate Now button forces an immediate capture for that specific post. Useful for one-off regenerations - you have edited the page and want the og:image refreshed right now rather than waiting for the next save or the daily refresh.

The button is disabled when the resolved Image source does not need a screenshot - Featured / Custom / Off / Featured-with-fallback when a Featured Image is set - because in those cases there is no screenshot to regenerate. See Per-post controls for the full list of disabled states.

Cache-flip orphan sweep

When you switch a content type (or an individual post) from Auto-screenshot to Featured / Custom / Off, the cached WebP file that the post used to emit is no longer needed. The plugin handles this automatically without you having to do anything.

How the sweep works:

  1. A weekly background job (doig_orphan_sweep) runs roughly every seven days. It looks at every cached screenshot and asks the resolver: "does the post that this cache file belongs to still need an Auto-screenshot?"
  2. If yes (the source flipped back, or never moved), the cache stays and any orphan marker is cleared.
  3. If no, the cache is marked with the current timestamp as orphaned. It is NOT deleted yet - it stays in place for a 14-day grace period.
  4. After 14 days as an orphan, the sweep purges the file from disk and clears the related meta.

The 14-day grace exists for one reason: if you flip an Image Source by mistake (or for an experiment), the cache is preserved so flipping back doesn't cost you the quota to re-capture every page. Inside the window, the original cache is still there ready to use.

If you want immediate cleanup (for example you're switching a 5,000-page CPT to Featured and want the disk space back now), use the Clear Entire Cache button on the Settings page. The orphan sweep is the gentler default - the manual purge is the override.

How the daily refresh works in practice

The daily refresh runs once every 24 hours (the exact slot is set when you activate the plugin). Each run:

  1. Scans every published page and post (and Premium custom post types).
  2. Skips any whose resolved Image source does not need a screenshot - Featured / Custom / Off / Featured-with-fallback posts that already have a Featured Image. Those posts emit their image source live each render, so there is nothing for the refresh to do.
  3. Skips any whose cached screenshot is still fresh (within the refresh interval).
  4. Skips any that are already pending (a capture is in flight).
  5. Re-queues anything that previously failed because of quota exhaustion, in case the quota has now reset.
  6. Queues everything else for capture, in batches that respect your monthly quota.

You do not have to do anything for this to run. It is part of the plugin's standard operation.