Skip to content
StaticScope
Overview
Get StaticScope

Environments and production

Separate staging and production copies, their addresses and branches, plus how to promote a build safely.

Getting started Updated 21 November 2026 6 min read

An environment is one place the site is published to. The GitHub add-on supports several at once: usually Production, plus Staging or UAT. Each has its own address, repository and branch, so you can check a change on staging before it reaches the live site.

S3 storage and Your server publish one prepared site to one place. They still have a site address, but not a set of named environments. The same separation is possible with separate WordPress installs or separate buckets and folders.

What an environment is

With GitHub, an environment is a record in WordPress with six fields that matter:

  • Name. Production, Staging, UAT. Up to 40 characters.
  • Host. Cloudflare, Netlify, GitHub Pages or another host. This only changes the setup guide and a little host-specific configuration.
  • Repository. The GitHub repository the files are pushed to, as owner/name.
  • Branch. The branch that holds this environment’s files. One environment per branch.
  • Address. The public base URL visitors use, such as https://www.example.com.
  • Options. Whether this is the live site, whether scheduled posts publish here and whether background jobs include it.

Deleting an environment removes the record in WordPress. It leaves the branch and the live site alone. A mistake in WordPress should not delete something visitors can see.

Base URL and deploy target

The address is a base URL, not a hint. Links, canonical tags, sitemap entries and asset URLs are written for it while the files are prepared. Change the address and you must publish again, because the old files still contain the old URL.

The deploy target is the repository and branch. StaticScope copies WordPress once, then prepares and pushes each environment in turn. The branch ends up holding the site at its top level, ready for a host to serve with no build step. Host files such as CNAME, _redirects, _headers and wrangler.jsonc are kept.

The live environment is pushed last. That means the prepared files left on disk match the live address, which is what the preview, site check and ZIP download use.

Production and preview are different targets

Tick This is the live site on exactly one environment. StaticScope clears the flag on the others when you save. The live environment is the copy visitors should see and the one search engines may index.

Every other environment gets a noindex, nofollow meta tag inserted after <head> on each page. robots.txt is not changed. This matters on Netlify, which does not hide branch deploys from search engines by itself, and on any host that gives a branch a public URL.

The preview under wp-content/uploads/staticscope-preview/ is a third thing. It is not published, it is always noindex and it exists so you can check the build. Do not treat it as staging: it sits on the WordPress server and disappears when you clear the prepared files.

Branch mapping for Git hosts

HostHow environments map
Cloudflare Pages or WorkersOne project for the repository. The live environment’s branch is the production branch; other branches get preview addresses. Workers also needs not_found_handling: "404-page", which the add-on writes into the Wrangler config.
NetlifyOne project for the repository. Turn on branch deploys for each non-live branch under Project configuration → Developer settings → Continuous deployment. Each branch gets <branch>--<project>.netlify.app.
GitHub PagesOne site per repository. Give each environment its own repository and choose Deploy from a branch in Settings → Pages. A custom domain is the reliable way to get the address you want.
Anything elsePoint the host at the branch. The files are at the top level and need no build command.

The environment form shows the steps for the host you choose, with your repository and branch filled in. It cannot create the host project for you. Do that once in the host’s dashboard.

Adding an environment

  1. Open StaticScope → Publish site.
  2. Select Add environment. On a new connection, the first environment form opens instead.
  3. Give it a name, choose the host, repository, branch and address.
  4. Tick This is the live site only for the production copy. Tick Publish here when a scheduled post goes live if that applies.
  5. Select Add environment, then publish to it.

If the branch already holds files that did not come from StaticScope, the form warns you and asks you to tick Replace what’s on this branch. Read that warning. Publishing replaces everything except host files such as those above. Files that were there stay in the branch history, but they are gone from the current site.

Promoting a build

Build once, check once, promote the same files:

  1. On the Overview, select Build a preview and open the preview.
  2. On Publish site, find the staging environment and select Publish last preview.
  3. Open the staging address and test the change.
  4. If it is right, select Publish last preview on the production environment.

Publish last preview reuses the prepared files without copying WordPress again. It is offered when the build is newer than that environment’s last publish, and hidden when the theme or plugins changed after the build. Publish copies WordPress again, so it always includes the latest content and code, at the cost of a slower run.

If posts or pages changed after the build, the environment card says how many. Publishing the last preview then ships the older content. That is sometimes what you want during a freeze; usually it is not.

Keeping production credentials out of staging

The GitHub connection is one token per WordPress install, shared by every environment on that install. The token can reach every repository its owner granted it. So a staging WordPress that holds the production token can push the production branch. The environment record is a convenience, not a security boundary.

If staging must not be able to publish production, separate the credentials:

  • Use a separate WordPress install for staging and give it a token that can only reach the staging repository. A fine-grained token is scoped per repository, not per branch, so separate branches in one repository are not enough.
  • Put the token in wp-config.php as STATICSCOPE_GITHUB_TOKEN on each install. Then it is not in the database and cannot travel with a database copy.
  • For S3, use separate buckets or prefixes and separate keys. For Your server, use separate folders and separate SSH keys, and do not give the staging key write access to the production folder.
  • Do not copy the database from production to staging and keep the add-on settings. The token, keys and environment records come with it.

A copied database carries credentials. If you clone production into staging to test, remove the GitHub token and storage keys there before anyone else uses it.

Scheduled publishing has the same rule. Only environments marked for scheduled posts publish when a post goes live. If staging should not publish automatically, leave that box unticked.

Next