Description
Allows you to filter whether the user can download or not.
Parameters
$args
(array)(required) An array of arguments passed from handle_download().
$args => array (
‘description’ => ‘File Transfer’,
‘type’ => ‘application/pdf’, // OR ‘application/octet-stream’,
‘disposition’ => ‘inline’, // OR ‘attachment’,
‘filename’ => $filepath_basename,
‘encoding’ => ‘binary’,
‘expires’ => 0,
‘cache-control’ => ‘must-revalidate’,
‘pragma’ => ‘public’,
‘length’ => $the_file_size,
)
Usage
add_filter( 'wpmem_dp_download_header_args', 'my_dp_download_header_args' );
function my_dp_download_header_args( $args ) {
/*
* This example changes PDF mime type to "octet-stream"
* so will download rather than open in a browser.
*/
$args['type'] = "application/octet-stream";
return $args;
}Changelog
- Introduced in 1.4.0
Source
wpmem_block is located in includes/class-wp-members-download-protect.php