The S3 storage add-on uploads the prepared site to a bucket you own and then fetches the homepage the way a visitor would. It works with Amazon S3, Cloudflare R2, Backblaze B2, DigitalOcean Spaces, Wasabi and any S3-compatible service with an endpoint, including MinIO.
There is no host in the middle. You own the bucket, the keys and the CDN, and StaticScope writes files into it. That is more setup than GitHub and less to go wrong later, as long as the public address is right.
Create the bucket
Create a bucket for this site alone. The add-on uploads to the bucket root and has no path prefix setting, so two sites in one bucket share a namespace and the first publish from either one can delete files the other put there. If you need two sites, use two buckets.
Bucket names are 3–63 characters: lowercase letters, numbers, dots and hyphens, starting and ending with a letter or number, with no .., no .-, no -. and nothing that looks like an IP address.
Keys and the IAM policy
For Amazon S3, create a dedicated IAM user rather than using root keys. The add-on uploads, lists, deletes and reads a test file back, so the user needs those actions on this bucket and nothing else. This is a starting policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::your-bucket"
},
{
"Effect": "Allow",
"Action": ["s3:PutObject", "s3:GetObject", "s3:DeleteObject"],
"Resource": "arn:aws:s3:::your-bucket/*"
}
]
}
List and delete are not optional. Listing is how the add-on finds an existing bucket and reports a wrong region. Deleting is how old pages disappear; the connection test warns when the keys can upload but not remove, and old files then pile up.
Other providers do this differently. R2 uses an API token scoped to one bucket, B2 an application key, DigitalOcean Spaces a key pair, MinIO a user and policy. The shape is the same: write and delete on one bucket.
Make it readable
A private bucket uploads perfectly and shows visitors an access denied page. Reading is a separate grant from writing. On Amazon S3, turn off the public access block for the bucket and add a bucket policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicRead",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-bucket/*"
}
]
}
Public read on every object includes anything else you ever put in that bucket, which is another reason to keep one site per bucket. If the bucket must stay private, put CloudFront in front of it with an origin access control and use the distribution’s address as the site address.
The bucket address is not a homepage. https://your-bucket.s3.eu-west-1.amazonaws.com serves index.html if you ask for it by name, but / gives you an error or a file listing. Use a custom domain or CloudFront as the site address.
R2 has no public address until you turn on its r2.dev subdomain or connect a domain. B2, Spaces and Wasabi need the bucket made public or a CDN in front of it.
Connect the add-on
Open StaticScope → Add-ons, choose S3 storage and pick a provider. The form only asks for what that provider needs.
| Field | Notes |
|---|---|
| Provider | Amazon S3, Cloudflare R2, Backblaze B2, DigitalOcean Spaces, Wasabi or custom. R2 is the suggested default. |
| Access key ID | No spaces or control characters. |
| Secret access key | Blank keeps the saved secret. You cannot read the saved one back. |
| Bucket name | The name, not the address. |
| Account ID | R2 only. |
| Region | Not shown for R2, which is fixed to auto. |
| Endpoint | Custom providers only. Full URL, no credentials in it. |
| Address style | Custom providers only. Path-style on by default, which is what MinIO wants. |
| Site address | The address visitors use. Required for R2 and custom providers; presets can derive one. |
Derived addresses look like https://bucket.s3.us-east-1.amazonaws.com for AWS and follow the same pattern for B2, Spaces and Wasabi. They are useful for the upload test and wrong for a homepage, which is why the site address is worth setting even when the field is optional.
The secret is encrypted with Sodium or OpenSSL using the site’s salts. If neither extension is available, saving fails with “This server can’t encrypt the secret key.” If the salts change later, the stored secret can no longer be decrypted and the add-on reports incomplete settings: paste the secret again.
Save before testing
The setup screen says it tests the connection “before saving anything permanent”. It does not. The save handler writes your settings first and runs the checks afterwards, so a wrong key is saved and reported, not rejected.
In practice: expect “Settings saved. Check the connection below.” after a bad key, fix the field and save again. Do not treat a saved setup as a working one until the connection panel shows every check green. The copy is ahead of the behaviour; nothing is broken.
What the connection check proves
- Keys accepted. The provider recognised the key ID and signed the request.
- Bucket found. It exists and the keys can see it. A wrong region shows the actual region, with a button to use it.
- Files can be uploaded. A small test file goes up and is read back. A delete failure is reported as a note, not a hard failure.
- Visitors can reach the site. The add-on fetches the address without credentials. 401 or 403 means a private bucket; a file listing means the address is being served as storage.
Content types and cache headers
Each file is uploaded with a content type and a cache header. HTML and HTM get public, max-age=0, must-revalidate; everything else gets public, max-age=3600. The idea is that a page is always checked, while a stylesheet or an image can sit in a cache for an hour.
Unknown extensions fall back to application/octet-stream, which a browser downloads instead of showing. If you add an unusual file type, set the type with the staticscope_s3_content_type filter. The header is changeable with staticscope_s3_cache_control. Both receive the file path.
add_filter( 'staticscope_s3_cache_control', function ( $value, $path ) {
return str_ends_with( $path, '.woff2' )
? 'public, max-age=31536000, immutable'
: $value;
}, 10, 2 );
Changing a cache header only affects files uploaded after the change. Files already in the bucket keep the header they were sent with, so either touch the files or clear the bucket and publish again.
What a publish does
Only files whose hash is not in the deploy record are uploaded. Assets go first and pages last, so an interrupted publish leaves the old pages pointing at files that are already there. Old files are deleted only after every upload succeeds; a failed delete is logged and retried next time.
Cancel stops between files and again before deletions. Files already sent stay in the bucket, and the next publish skips them, so cancelling a large upload costs you nothing. One publish runs at a time.
After uploading, the add-on fetches the site address without credentials. A success there sets the Live badge on the publish screen. A 200 that is an XML bucket listing counts as not live, which is the right call.
Files put in the bucket by hand, or by another tool, are never deleted, because the add-on only removes what it uploaded. The deploy record is keyed to the bucket and endpoint, so changing either starts a fresh namespace and leaves the old bucket alone.
The different-address warning
Links in the prepared site are absolute. If you change the site address after building, the publish screen says:
The prepared site was built for a different address. Build it again so links point to address.
That is a warning, not a block. S3 will publish the stale copy if you press the button anyway, and you get a site whose pages load while its canonical tags, sitemap and internal links point somewhere else. The Your server add-on refuses in the same situation. Treat the S3 warning as a refusal: build again.
When it fails
| Message | What to change |
|---|---|
| “That bucket doesn’t exist yet.” | The name or the region. The screen offers to create the bucket when it can. |
| “The access key ID wasn’t recognised.” | Wrong key, or a key from another provider. |
| “The secret key or region doesn’t match.” | Check both. A region mismatch usually comes with a suggested region button. |
| “These keys can’t use this bucket.” | The policy is missing put or delete, or names a different bucket. |
| “Couldn’t reach host.” | The endpoint, or the WordPress host blocking outbound requests. |
| “Visitors get access denied.” | Public read is off. Fix the bucket policy or the CDN. |
| “The address lists the bucket’s files.” | The address is the storage endpoint. Use a custom domain or website endpoint. |
| “Published. The site address didn’t answer…” | DNS, certificate or the domain not pointing at this bucket. Files are uploaded; only the check failed. |
A publish that dies mid-request is reported as stopped when the lock clears. Run it again: uploaded files are skipped, so it picks up where it stopped. If it keeps happening, ask your host to raise PHP’s time limit.
Keeping keys out of the database
Every field has a constant. Values in wp-config.php win over the screen, which then shows an info notice saying so. The full set is STATICSCOPE_S3_ACCESS_KEY, STATICSCOPE_S3_SECRET_KEY, STATICSCOPE_S3_BUCKET, STATICSCOPE_S3_REGION, STATICSCOPE_S3_PROVIDER, STATICSCOPE_S3_ACCOUNT_ID, STATICSCOPE_S3_ENDPOINT, STATICSCOPE_S3_PUBLIC_URL and STATICSCOPE_S3_PATH_STYLE.
WP-CLI
wp staticscope s3 status
wp staticscope s3 test
wp staticscope s3 publish
publish runs the same safety checks as the screen, including the stale-preview refusal, and exits with an error carrying the result message. test runs the upload, read-back and public check. status prints the provider, bucket, address, last check and last publish.
Who can use it
The S3 screen is manage_options only. There is no publish-only capability, unlike GitHub. Anyone who can publish can also change the bucket.