Credentials in wp-config.php
You can define any provider field as a constant in wp-config.php instead of saving it in Settings. This keeps secrets out of the database, out of database backups and out of site exports.
How it works
Section titled “How it works”- Each constant is named
OMNIOFFLOADER_{PROVIDER}_{FIELD}, in capital letters. - A constant always wins over a value saved in Settings.
- In Settings, a field set by a constant is locked and shows Locked by the … constant in wp-config.php.
- Every field can be a constant, not only the keys. You can mix: for example, keep the key and secret in
wp-config.phpand enter the bucket and domain in Settings. - Secrets are never sent back to the browser, whether they come from a constant or from the database.
Where to add them
Section titled “Where to add them”Add the lines to wp-config.php above the line that says /* That's all, stop editing! Happy publishing. */. Then reload the Settings page.
Constants for each provider
Section titled “Constants for each provider”define( 'OMNIOFFLOADER_CLOUDFLARE_R2_KEY', 'your-access-key-id' );define( 'OMNIOFFLOADER_CLOUDFLARE_R2_SECRET', 'your-secret-access-key' );define( 'OMNIOFFLOADER_CLOUDFLARE_R2_ENDPOINT', 'https://your-account-id.r2.cloudflarestorage.com' );define( 'OMNIOFFLOADER_CLOUDFLARE_R2_BUCKET', 'my-site-media' );define( 'OMNIOFFLOADER_CLOUDFLARE_R2_DOMAIN', 'https://media.yourdomain.com' );define( 'OMNIOFFLOADER_AMAZON_S3_KEY', 'your-access-key-id' );define( 'OMNIOFFLOADER_AMAZON_S3_SECRET', 'your-secret-access-key' );define( 'OMNIOFFLOADER_AMAZON_S3_BUCKET', 'my-site-media' );define( 'OMNIOFFLOADER_AMAZON_S3_REGION', 'us-east-1' );define( 'OMNIOFFLOADER_AMAZON_S3_DOMAIN', 'https://media.yourdomain.com' );define( 'OMNIOFFLOADER_DIGITALOCEAN_SPACES_KEY', 'your-spaces-access-key' );define( 'OMNIOFFLOADER_DIGITALOCEAN_SPACES_SECRET', 'your-spaces-secret-key' );define( 'OMNIOFFLOADER_DIGITALOCEAN_SPACES_ENDPOINT', 'https://nyc3.digitaloceanspaces.com' );define( 'OMNIOFFLOADER_DIGITALOCEAN_SPACES_REGION', 'nyc3' );define( 'OMNIOFFLOADER_DIGITALOCEAN_SPACES_BUCKET', 'my-site-media' );define( 'OMNIOFFLOADER_DIGITALOCEAN_SPACES_DOMAIN', 'https://media.yourdomain.com' );define( 'OMNIOFFLOADER_BACKBLAZE_B2_KEY', 'your-application-key-id' );define( 'OMNIOFFLOADER_BACKBLAZE_B2_SECRET', 'your-application-key' );define( 'OMNIOFFLOADER_BACKBLAZE_B2_ENDPOINT', 'https://s3.us-west-004.backblazeb2.com' );define( 'OMNIOFFLOADER_BACKBLAZE_B2_REGION', 'us-west-004' );define( 'OMNIOFFLOADER_BACKBLAZE_B2_BUCKET', 'my-site-media' );define( 'OMNIOFFLOADER_BACKBLAZE_B2_DOMAIN', 'https://media.yourdomain.com' );define( 'OMNIOFFLOADER_WASABI_KEY', 'your-access-key-id' );define( 'OMNIOFFLOADER_WASABI_SECRET', 'your-secret-access-key' );define( 'OMNIOFFLOADER_WASABI_BUCKET', 'my-site-media' );define( 'OMNIOFFLOADER_WASABI_REGION', 'us-east-1' );define( 'OMNIOFFLOADER_WASABI_DOMAIN', 'https://media.yourdomain.com' );define( 'OMNIOFFLOADER_S3_COMPATIBLE_NAME', 'MinIO' );define( 'OMNIOFFLOADER_S3_COMPATIBLE_KEY', 'your-access-key-id' );define( 'OMNIOFFLOADER_S3_COMPATIBLE_SECRET', 'your-secret-access-key' );define( 'OMNIOFFLOADER_S3_COMPATIBLE_ENDPOINT', 'https://minio.yourdomain.com:9000' );define( 'OMNIOFFLOADER_S3_COMPATIBLE_REGION', 'us-east-1' );define( 'OMNIOFFLOADER_S3_COMPATIBLE_PATH_STYLE', true );define( 'OMNIOFFLOADER_S3_COMPATIBLE_BUCKET', 'my-site-media' );define( 'OMNIOFFLOADER_S3_COMPATIBLE_DOMAIN', 'https://media.yourdomain.com' );NAME is the Provider Label. PATH_STYLE turns on Use Path-Style Endpoint when set to true (or '1').
Full list
Section titled “Full list”| Provider | Constant prefix | Fields |
|---|---|---|
| Cloudflare R2 | OMNIOFFLOADER_CLOUDFLARE_R2_ |
KEY, SECRET, ENDPOINT, BUCKET, DOMAIN |
| Amazon S3 | OMNIOFFLOADER_AMAZON_S3_ |
KEY, SECRET, BUCKET, REGION, DOMAIN |
| DigitalOcean Spaces | OMNIOFFLOADER_DIGITALOCEAN_SPACES_ |
KEY, SECRET, ENDPOINT, REGION, BUCKET, DOMAIN |
| Backblaze B2 | OMNIOFFLOADER_BACKBLAZE_B2_ |
KEY, SECRET, ENDPOINT, REGION, BUCKET, DOMAIN |
| Wasabi | OMNIOFFLOADER_WASABI_ |
KEY, SECRET, BUCKET, REGION, DOMAIN |
| Any S3-Compatible Storage | OMNIOFFLOADER_S3_COMPATIBLE_ |
NAME, KEY, SECRET, ENDPOINT, REGION, PATH_STYLE, BUCKET, DOMAIN |