Automattic\WooCommerce\Internal\ProductDownloads

DownloadableFileAttachments::handle_redirect_canonical │ public │ WC 1.0

Skip canonical redirects for downloadable product file attachment requests.

Feed requests aren't turned into 404s, so with attachment pages disabled WordPress would redirect them to the file.

Method of the class: DownloadableFileAttachments{}

No Hooks.

Returns

string|false|mixed.

Usage

$DownloadableFileAttachments = new DownloadableFileAttachments();
$DownloadableFileAttachments->handle_redirect_canonical( $redirect_url );
$redirect_url(string|false|mixed) (required)
Redirect URL.

DownloadableFileAttachments::handle_redirect_canonical() code WC 11.3.0

public function handle_redirect_canonical( $redirect_url ) {
	return ( is_attachment() && $this->is_hidden_attachment( absint( get_query_var( 'attachment_id' ) ) ) ) ? false : $redirect_url;
}