Defining the Bucket
When you have installed WP Offload Media and connected your AWS or DigitalOcean account, you will need to select a bucket to store your offloaded media. You can do this in the settings of the plugin by choosing from a list of buckets you have access to, or by entering the bucket name manually.
If you are looking to remove the manual process of selecting the bucket then you can define the bucket in your wp-config.php file.
The preferred method is to use “bucket” and “region” keys in the
AS3CF_SETTINGS define as detailed in the Settings Constants doc. The
AS3CF_SETTINGS constant can be used to define every setting that Offload Media also exposes in the UI.
However, you can still use this constant:
define( 'AS3CF_BUCKET', 'mybucket');
As with the
AS3CF_SETTINGS constant, this is particularly helpful for automatic deployments of the plugin to new sites, or when you want to remove the ability for users to change the bucket by mistake. The
AS3CF_BUCKET constant will override the bucket defined in
AS3CF_SETTINGS as well as disabling entry of the bucket via the UI.
You can also define the location of any new buckets created in the settings with this constant:
define( 'AS3CF_REGION', 'eu-west-1');
This is helpful when you want to select non standard locations when creating buckets.
Assets Addon (Deprecated)
PLEASE NOTE: The Assets addon does not work with WP Offload Media 2.0 or later, please use the Assets Pull addon instead.
You can also define the bucket used by the Assets addon using the constant:
define( 'AS3CF_ASSETS_BUCKET', 'myassetsbucket');
If you have defined the
AS3CF_REGION, this will also apply the location to buckets created via the “Assets” tab.