Automattic\WooCommerce\Internal\ProductDownloads
DownloadableFileAttachments::handle_redirect_canonical
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.
Метод класса: DownloadableFileAttachments{}
Хуков нет.
Возвращает
string|false|mixed.
Использование
$DownloadableFileAttachments = new DownloadableFileAttachments(); $DownloadableFileAttachments->handle_redirect_canonical( $redirect_url );
- $redirect_url(строка|false|разное) (обязательный)
- Redirect URL.
Код DownloadableFileAttachments::handle_redirect_canonical() DownloadableFileAttachments::handle redirect canonical 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;
}