Documentation

Filtering URLs for multiple domains

If your WordPress site has multiple domains and content authors access it from any one of them, you might end up with URLs in your database content that do not have the same local domain as saved in the “Site URL” setting. This means WP Offload Media will not be able to recognize some URLs as belonging to the local site and will not filter them to their cloud storage bucket equivalent.

If you’re using something like the following code in your wp-config.php file then you might be seeing this problem.

define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );

Some methods of domain mapping might also produce this problem.

WP Offload Media has an ‘as3cf_local_domains’ filter that you can use to supply alternative domains that your site uses.

function as3cf_local_domains( $domains ) {
    $domains[] = 'wibble.example.com';
    $domains[] = 'wobble.example.com';

    return $domains;
}
add_filter( 'as3cf_local_domains', 'as3cf_local_domains', 10, 1 );

The first entry in the $domains array will be the primary domain that is configured for the site, you can check $domains[0] should you need to supply different alternate domains for any reason, such as for a subsite in a multisite network.