Developers

apply_filters( 'riff_protected_url', string $url, int $id, int $expires )

Filters the address a protected file is sent from instead of WordPress: a signed address on a CDN or in object storage, such as a CloudFront or S3 presigned URL or a Bunny or Cloudflare token, that stops working at $expires. Riff has checked that the visitor may have the file before it asks, and sends them on with a 302 nothing caches. Empty, the default, sends the file as riff_protected_send says.

Parameters

$urlstring
Signed address, or empty.
$idint
Attachment ID.
$expiresint
When the address should stop working, as a Unix time: an hour on.

More Information

Usage

add_filter( 'riff_protected_url', function ( $url, $id, $expires ) {
	return $url;
}, 10, 3 );

Source

$url = (string) apply_filters( 'riff_protected_url', '', $id, time() + HOUR_IN_SECONDS );

Changelog

VersionDescription
5.7.0Introduced.