WordPress at Your Fingertips
function is not described

WC_Download_Handler::get_download_content_type() private WC 1.0

Get content type of a download.

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

No Hooks.

Return

String.

Usage

$result = WC_Download_Handler::get_download_content_type( $file_path );
$file_path(string) (required)
File path.

Code of WC_Download_Handler::get_download_content_type() WC 5.7.1

private static function get_download_content_type( $file_path ) {
	$file_extension = strtolower( substr( strrchr( $file_path, '.' ), 1 ) );
	$ctype          = 'application/force-download';

	foreach ( get_allowed_mime_types() as $mime => $type ) {
		$mimes = explode( '|', $mime );
		if ( in_array( $file_extension, $mimes, true ) ) {
			$ctype = $type;
			break;
		}
	}

	return $ctype;
}