Filter
rpress_protected_directory_allowed_filetypes
On this page
Filters the file extensions that remain downloadable in the protected uploads folder.
Runs when the .htaccess rules for the RestroPress uploads directory are generated using the direct download method. The default list is jpg, jpeg, png, gif, mp3 and ogg; matching files are allowed while everything else is denied. The list is joined with | inside a FilesMatch regular expression, so return plain extensions.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$allowed_filetypes | array | File extensions that may be served directly. |
Return value#
array. The list of allowed file extensions.
Example#
function my_protected_directory_filetypes( $allowed_filetypes ) {
$allowed_filetypes[] = 'webp';
return $allowed_filetypes;
}
add_filter( 'rpress_protected_directory_allowed_filetypes', 'my_protected_directory_filetypes' );
Notes#
Only applied for the direct method (the default case); the redirect method writes a simple Options -Indexes rule.
Source#
Applied in:
includes/admin/upload-functions.php(line 130), inrpress_get_htaccess_rules()
See also#
Was this page helpful?
