New! – BackWPup PRO with Restore function! Already over 9 Million Downloads!

How to add S3 services programmatically

Starting from BackWPup version 3.6.10 is possible to add new S3 services to the default list through the filter hook backwpup_s3_destination.

Every service we need to add can be set via an array that specifies the label, the region and the url of the service we want to add.
Here below we set an example:

add_filter( 'backwpup_s3_destination', function ( $destinations ) {
        return array_merge( array(array(
                        'label'    => __( 'FirstServiceTest: AMS3', 'backwpup' ),
                        'region'   => 'ams3',
                        'base_url' => 'https://example.com',
                ),
                array(
                        'label'    => __( 'SecondServiceTest: AMS', 'backwpup' ),
                        'region'   => 'nl-ams',
                        'base_url' => 'https://example.com',
                )
        ), $destinations );
} );

In this example we set two arrays, one for the FirstServiceTest and a second one for the SecondServiceTest.
These new services now will be available in the S3 service list for the related jobs.