Documentation

Settings Constants

All settings within WP Offload Media and the Assets Addon can be defined using two constants within your wp-config.php file.

WP Offload Media

define( 'WPOS3_SETTINGS', serialize( array(
    // S3 bucket to upload files
    'bucket' => 'mybucket',
    // S3 bucket region (e.g. 'us-west-1' - leave blank for default region)
    'region' => '',
    // Automatically copy files to S3 on upload
    'copy-to-s3' => true,
    // Rewrite file URLs to S3
    'serve-from-s3' => true,
    // S3 URL format to use ('path', 'cloudfront')
    'domain' => 'path',
    // Custom domain if 'domain' set to 'cloudfront'
    'cloudfront' => 'cdn.exmple.com',
    // Enable object prefix, useful if you use your bucket for other files
    'enable-object-prefix' => true,
    // Object prefix to use if 'enable-object-prefix' is 'true'
    'object-prefix' => 'wp-content/uploads/',
    // Organize S3 files into YYYY/MM directories
    'use-yearmonth-folders' => true,
    // Serve files over HTTPS
    'force-https' => false,
    // Remove the local file version once offloaded to S3
    'remove-local-file' => false,
    // Append a timestamped folder to path of files offloaded to S3
    'object-versioning' => true,
) ) );

Assets Pull Addon

define( 'WPOS3_ASSETS_PULL_SETTINGS', serialize( array(
    // Rewrite enqueued style/script URLs to CDN domain
    'rewrite-urls' => false,
    // CDN domain to use
    'domain' => 'assets.example.com',
    // Serve files over HTTPS
    'force-https' => false,
) ) );

Assets Addon (Deprecated)

define( 'WPOS3_ASSETS_SETTINGS', serialize( array(
    // S3 bucket to upload assets
    'bucket' => 'mybucket',
    // S3 bucket region (e.g. 'us-west-1' - leave blank for default region)
    'region' => '',
    // Copy assets to S3 and rewrite URLs
    'enable-addon' => false,
    // Enable automatic scanning
    'enable-cron' => true,
    // Extensions to offload to S3
    'file-extensions' => 'css,js,jpg,jpeg,png,gif,woff,woff2,ttf,svg,eot,otf,ico',
    // S3 URL format to use ('path', 'cloudfront')
    'domain' => 'path',
    // Custom domain if 'domain' set to 'cloudfront'
    'cloudfront' => 'cdn.exmple.com',
    // Enable object prefix, useful if you use your bucket for other files
    'enable-script-object-prefix' => false,
    // Object prefix to use if 'enable-object-prefix' is 'true'
    'object-prefix' => '',
    // Serve files over HTTPS
    'force-https' => false,
    // Minify CSS and JS files
    'enable-minify' => true,
    // Enable excluding files from being minified
    'enable-minify-excludes' => true,
    // List of files to exclude from minification
    'minify-excludes' =>
        'wp-includes/js/jquery/jquery.js' . PHP_EOL .
        'wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js',
    // Gzip files before offloading to S3
    'enable-gzip' => true,
    // Enable initiating a scan using a URL endpoint
    'enable-custom-endpoint' => false,
) ) );

These should be placed before:

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');