WordPress at Your Fingertips
function is not described

WC_Download_Handler::download_error() private WC 1.0

Die with an error message if the download fails.

{} It's a method of the class: WC_Download_Handler{}

No Hooks.

Return

null. Nothing.

Usage

$result = WC_Download_Handler::download_error( $message, $title, $status );
$message(string) (required)
Error message.
$title(string)
Error title.
Default: ''
$status(int)
Error status.
Default: 404

Code of WC_Download_Handler::download_error() WC 5.6.0

private static function download_error( $message, $title = '', $status = 404 ) {
	/*
	 * Since we will now render a message instead of serving a download, we should unwind some of the previously set
	 * headers.
	 */
	header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
	header_remove( 'Content-Description;' );
	header_remove( 'Content-Disposition' );
	header_remove( 'Content-Transfer-Encoding' );

	if ( ! strstr( $message, '<a ' ) ) {
		$message .= ' <a href="' . esc_url( wc_get_page_permalink( 'shop' ) ) . '" class="wc-forward">' . esc_html__( 'Go to shop', 'woocommerce' ) . '</a>';
	}
	wp_die( $message, $title, array( 'response' => $status ) ); // WPCS: XSS ok.
}