Configuration

Constants, environment variables, admin options, presets, and connection Test.

Settings resolve in order:

  1. PHP constants (define('WP_TO_S3_…', …) in wp-config.php)
  2. Environment variables (same names)
  3. wp-admin → Media → WP to S3 (wp_to_s3_settings option)
  4. Defaults

Constants/env always win over the options UI when defined.

Variables

NameTypeDefaultDescription
WP_TO_S3_ENABLEDboolfalseEnable upload + serve hooks
WP_TO_S3_ENDPOINTstring''S3 API endpoint URL
WP_TO_S3_REGIONstringus-east-1Region (provider-specific)
WP_TO_S3_BUCKETstring''Bucket name
WP_TO_S3_PREFIXstring''Optional key prefix
WP_TO_S3_ACCESS_KEYstring''Access key ID
WP_TO_S3_SECRET_KEYstring''Secret access key
WP_TO_S3_PATH_STYLEboolfalsePath-style addressing (/bucket/key)
WP_TO_S3_DELETE_LOCALboolfalseUnlink local after successful put
WP_TO_S3_OBJECT_ACLstring''e.g. public-read; empty = omit ACL
WP_TO_S3_REDIRECT_MISSINGboolfalse302 to S3 instead of PHP stream
WP_TO_S3_USE_PRESIGNEDboolfalsePresign when redirecting
WP_TO_S3_PRESIGN_TTLint3600Presign TTL seconds
WP_TO_S3_PUBLIC_BASE_URLstring''Optional CDN/public base for attachment URLs
WP_TO_S3_REWRITE_CONTENTboolfalseAllow Tools content rewrite UI
WP_TO_S3_CONCURRENCYint3PHP migrate concurrency (1 = sequential)
WP_TO_S3_PROVIDERstringcustomPreset id: aws, linode, r2, minio, spaces, custom
WP_TO_S3_S5CMD_PATHstring(PATH)Optional absolute path to s5cmd
WP_TO_S3_CAPABILITYstringmanage_optionsCapability required for Media → WP to S3 (settings, migrate, tools). Default Administrators only.

Bool env values: 1, true, yes, on (case-insensitive).

Secrets

wp-config.php example

define('WP_TO_S3_ENABLED', true);
define('WP_TO_S3_ENDPOINT', 'https://s3.us-east-1.amazonaws.com');
define('WP_TO_S3_REGION', 'us-east-1');
define('WP_TO_S3_BUCKET', 'your-bucket');
define('WP_TO_S3_PREFIX', '');
define('WP_TO_S3_ACCESS_KEY', getenv('WP_TO_S3_ACCESS_KEY') ?: '');
define('WP_TO_S3_SECRET_KEY', getenv('WP_TO_S3_SECRET_KEY') ?: '');
define('WP_TO_S3_PATH_STYLE', false);
define('WP_TO_S3_DELETE_LOCAL', false);
// define('WP_TO_S3_PUBLIC_BASE_URL', 'https://cdn.example.com/media');
// define('WP_TO_S3_OBJECT_ACL', 'public-read'); // only if you want public objects
// define('WP_TO_S3_CAPABILITY', 'edit_posts'); // optional: allow Editors (default manage_options)

Admin UI access

The settings UI lives under Media → WP to S3. By default only users with manage_options (Administrators) can open it or run doctor/migrate/tools AJAX.

To allow a lesser role that has a specific capability (e.g. Editors with edit_posts):

define('WP_TO_S3_CAPABILITY', 'edit_posts');

Media Library bulk actions / attachment metabox still use the normal upload_files capability.

Provider presets

Admin Media → WP to S3 → Provider preset fills endpoint/region/path-style hints. All presets have equal weight; Advanced fields remain editable.

Amazon S3

define('WP_TO_S3_ENDPOINT', 'https://s3.us-east-1.amazonaws.com');
define('WP_TO_S3_REGION', 'us-east-1');
define('WP_TO_S3_BUCKET', 'my-bucket');
define('WP_TO_S3_PATH_STYLE', false);

Linode Object Storage

define('WP_TO_S3_ENDPOINT', 'https://us-ord-1.linodeobjects.com');
define('WP_TO_S3_REGION', 'us-ord-1');
define('WP_TO_S3_BUCKET', 'your-bucket');
define('WP_TO_S3_PATH_STYLE', false);

Cloudflare R2

define('WP_TO_S3_ENDPOINT', 'https://<ACCOUNT_ID>.r2.cloudflarestorage.com');
define('WP_TO_S3_REGION', 'auto');
define('WP_TO_S3_BUCKET', 'media');
define('WP_TO_S3_PATH_STYLE', false);

MinIO

define('WP_TO_S3_ENDPOINT', 'https://minio.example.com');
define('WP_TO_S3_REGION', 'us-east-1'); // often arbitrary for MinIO
define('WP_TO_S3_BUCKET', 'wordpress');
define('WP_TO_S3_PATH_STYLE', true); // typically required

DigitalOcean Spaces

define('WP_TO_S3_ENDPOINT', 'https://nyc3.digitaloceanspaces.com');
define('WP_TO_S3_REGION', 'nyc3');
define('WP_TO_S3_BUCKET', 'my-space');
define('WP_TO_S3_PATH_STYLE', false);

Bucket policy notes

Verify config

wp s3 doctor

Or use Test next to Save Changes on Media → WP to S3 → Settings (PUT/GET/DELETE probe of wp-to-s3.txt with body Hello, world!). Failures list the method, HTTP status, and error message.

Save gating: changing connection fields (provider, endpoint, region, bucket, prefix, keys, path-style, object ACL) disables Save until Test passes for those values. Non-connection options (CDN URL, concurrency, delete-local, redirects, content rewrite) can be saved without re-testing. Unchecking Enabled always allows Save. A successful Test fingerprint is remembered for the browser tab (sessionStorage) so a refresh mid-edit does not force an extra test if fields are unchanged.

Tools → Run doctor (or wp s3 doctor) prints full diagnostics including the same connection test.

Should report configured: yes, sdk: yes, connectivity: OK, and connection_test: OK.

s5cmd (parallel bulk migrate)

Constant / envPurpose
WP_TO_S3_S5CMD_PATHAbsolute path to s5cmd if not on PATH

Bulk wp s3 migrate uses s5cmd when available (--engine=auto default).
Admin migrate and runtime Media Library uploads use the PHP AWS SDK (concurrency default 3).

// optional
define('WP_TO_S3_S5CMD_PATH', '/usr/local/bin/s5cmd');

Multisite

Not supported in 1.0. The admin UI refuses to configure on multisite networks.