Opens in a new tab

Regeneration & rebuilds

When MyStaticWP rebuilds your static pages, how it does it without emptying your site, and how to read the journal.

Static pages that stay fresh by themselves

A static page is a copy taken at a given moment. If the dynamic page changes and the copy does not, visitors see the old page. MyStaticWP therefore rebuilds the static copies for you, at the right moments, and tells you what it did.

You rarely have to do anything. A page you save is rebuilt. A change that touches every page (the theme, a menu, a global style, a plugin update) rebuilds the whole site once. A daily rebuild catches anything else. And when you want to force it, one button rebuilds everything, and another rebuilds only what is out of date.

Three guarantees shape the way rebuilds work:

  • Visitors are never left with nothing. The static pages already in place keep being served while a rebuild runs.
  • A failed page keeps its previous copy. A broken rebuild does not replace a good page.
  • Every rebuild is written down. The journal on the Switch screen says what happened to each page, and why.
On this page

When a rebuild starts

Event What is rebuilt
Page saved That page, and the blog index and archives that list it. Deleting or trashing a page removes its static copy.
Address changed The page under its new address. The old static file is removed.
Polylang save The page and its translations, so their language switchers point to the right addresses.
Menu updated The whole site.
Bricks template saved The whole site. A header or footer template appears on every page.
Shared change The whole site, once, about a minute after the last change. See the next section.
Plugin blocking saved The pages whose blocked plugins changed, if you left the option ticked.
Style changed The pages affected by the new generation style.
Every day The whole site. It keeps the security tokens of forms from expiring on pages nobody edits.
Your click Regenerate all, or only the outdated or missing pages.

Only public, published pages become static. WooCommerce system pages and pages you set to always dynamic are left out on purpose.

Shared changes

Some changes affect every page at once, and a simple page save would not catch them. MyStaticWP recognises them and schedules one rebuild of the whole site about a minute later. Several changes in a row collapse into that one rebuild.

Change Examples
Site identity Site title, tagline, site icon.
Front page The page shown as home page or as posts page, or a change between them.
Theme Switching theme, or saving the Customizer.
Bricks Global settings, global classes, theme styles, the colour palette, global variables and global elements.
Updates Installing or updating a plugin or a theme. What a plugin prints on the front end may have changed on every page.

Nothing is scheduled when static mode is off.

Regenerate all

The Regenerate all button on the Switch screen rebuilds every public page, the blog index and the archives. Use it the first time you turn static mode on, and whenever you want a clean start.

Its behaviour depends on the size of the site:

Site size How it runs
Small Up to 30 items: rebuilt in one go, from an empty cache.
Larger Rebuilt in batches, with a progress bar. Each batch stays within a time budget of about half of your host’s time limit, between 5 and 20 seconds.

On a larger site, the existing static pages keep being served while the rebuild runs. Nothing is wiped first. At the end, the copies of pages that no longer exist are removed, together with the folders they leave empty.

On a test site with 41 pages, a full rebuild took between about half a minute and a little over a minute, depending on the load of the server.

Regenerate outdated or missing pages only

This button rebuilds just what needs it, and leaves the rest alone. A page counts as outdated in three cases:

  • it has no static copy at all;
  • its static copy is older than the last time the page was edited;
  • its static copy is older than the last shared change (a template, a menu, a global style, the theme).

It is the quickest way to bring a site back in step after a change you are not sure was caught.

A rebuild in progress

When a rebuild is queued, a box with a progress bar appears on the plugin’s screens: Regenerating static pages… N pages of M.

  • You can leave the page. The rebuild carries on in the background, driven by WordPress’s scheduled tasks and by the admin screens you have open.
  • Only one rebuild runs at a time. Starting a second one while the first runs does not double the work.
  • If a rebuild is interrupted, the next scheduled step picks it up.

Because visitors are served static files, WordPress does not start for them, and its scheduled tasks only run when something reaches WordPress: a visit to the administration, a logged-in visit, a page that is not static. On a large or quiet site, ask your host to call wp-cron.php every few minutes with a real scheduled task. That makes background rebuilds reliable.

The journal: Last regeneration

The Switch screen shows the Last regeneration. It says why the run happened, when, how many pages were regenerated, skipped and failed, and how long it took. Open Every page, slowest first to see each page with its result and its time in milliseconds.

Reason shown What started the run
Manual rebuild You clicked Regenerate all.
Daily rebuild The daily task.
Rebuild after a shared change A change that affects every page (see above).
Rebuild after a style change You changed a generation style.
Outdated pages only You clicked Regenerate outdated or missing pages only.

Only the latest run is kept, and at most 500 pages are listed. It is a journal of the last rebuild, not a history.

Regenerated, skipped, failed

Result Meaning
Regenerated The static copy was written.
Skipped On purpose, and the reason is given. A skipped page is not an error.
Failed The page could not be captured. The reason and the HTTP code are shown, and the previous copy stays in place.

The reasons for a skipped page are:

  • a WooCommerce system page, which is always served live;
  • a page marked always dynamic, which is always served live;
  • a page that is not published;
  • something that is not a public page;
  • an address that redirects elsewhere, so there is nothing to store. If a page that had a static copy now redirects, the old copy is removed.

Bricks templates are not pages. They are left out of the journal without a mention.

Rebuild a single page from the editor

On the edit screen of a page, a MyStaticWP box has a Push this page button. It rebuilds that page immediately and shows Pushing… then Pushed., or Push failed.. The box also says when the static copy was last pushed.

  • With static mode off, the box says there is nothing to push.
  • A draft has no static page. Publish it first.

What a rebuild really does

For each page, MyStaticWP asks your own site for the dynamic page as an anonymous visitor would, and stores the answer as a static file under the page’s address. The request is marked so that it always reaches the real page and never a copy. Then, for a Strict page, forms are replaced. The result is written to the folder of that page’s style.

The page is captured with the plugins and the style it would have for a visitor. That includes the per-page plugin choices you made on the Plugins screen: a page rebuilt after you blocked a plugin no longer contains that plugin’s output.

If something looks wrong

  • A page shows old content. Save it again, or use Push this page. If several pages are stale, click Regenerate outdated or missing pages only.
  • A change to the theme or to a global style is not visible. A shared change rebuilds the site about a minute later. Wait, then check the journal for Rebuild after a shared change.
  • The progress bar does not move. On a quiet site, background steps depend on scheduled tasks. Keep the Switch screen open to drive the rebuild, or ask your host to call wp-cron.php regularly.
  • A page is listed as failed. Read the reason. Open the page yourself: an error on the live page makes a rebuild fail.
  • A page is listed as skipped and you expected a static copy. Check whether it is published, whether it redirects, and whether it is set to always dynamic.

The styles are explained in Generation styles: Hybrid & Strict. For other problems, see Troubleshooting.